1.下载地址:https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.30-winx64.zip
2.安装
-
解压:解压到D盘,改名为:mysql-5.7.30
-
设置环境变量
-
系统—>高级系统设置—>环境变量—>系统变量
新建 变量名:MYSQL_HOME 值:D:\mysql-5.7.30 - Path最后添加:;%MYSQL_HOME%\bin
-
系统—>高级系统设置—>环境变量—>系统变量
-
mysql-5.7.30下创建my.ini,内容如下:
[mysqld] #端口号 port = 3306 #mysql-5.7.30-winx64的路径 basedir=D:\mysql-5.7.30 #mysql-5.7.30-winx64的路径+\data datadir=D:\mysql-5.7.30\data #最大连接数 max_connections=200 #编码 character-set-server=utf8 default-storage-engine=INNODB sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES skip-grant-tables #无需密码验证 [mysql] #编码 default-character-set=utf8
-
管理员运行cmd
- mysqld -install 成功:Service successfully installed
- mysqld –initialize 成功:没有提示
- net start mysql 启动
-
修改密码
- mysql -u root -p 回车
- use mysql
- update user set authentication_string=password(“123456”) where user=“root”
- net stop mysql 停止服务器
-
删除my.ini 中 skip-grant-tables
-
net start mysql 启动
-
mysql -u root -p 回车输入密码
-
alter user user() identified by “123456”;
3. Ubuntu16.04 安装MySQL ODBC驱动
-
下载:https://cdn.mysql.com/archives/mysql-connector-odbc-5.2/mysql-connector-odbc-5.2.7-linux-glibc2.5-x86-64bit.tar.gz
-
安装
- 解压到 /use/local 命名为:mysql-connector-odbc-5.2.7
- cd /usr/local/mysql-connector-odbc-5.2.7/bin
- sudo ./myodbc-installer -d -a -n “MYSQL” -t “DRIVER=/usr/lib/libmyodbc5a.so;SETUP=/usr/lib/libmyodbc5a.so”
- sudo cp -r /usr/local/mysql-connector-odbc-5.2.7/lib/. /usr/lib
- sudo cp -r /usr/local/mysql-connector-odbc-5.2.7/lib/. /usr/lib64
-
配置ODBC驱动
-
sudo vi /etc/odbcinst.ini (与执行myodbc-installer 冲突)
[MYSQL]
Description=ODBC for MySQL
Driver=/usr/lib/libmyodbc5a.so
SETUP=/usr/lib/libmyodbc5a.so
Driver64=/usr/lib64/libmyodbc5a.so
SETUP64=/usr/lib64/libmyodbc5a.so
FileUsage=1
-
sudo vi /etc/odbcinst.ini (与执行myodbc-installer 冲突)
-
配置访问数据库信息
- 创建echat 数据库
-
sudo gedit /etc/odbc.ini
[echat]
Driver = /usr/lib/libmyodbc5a.so
SERVER = 192.168.2.111
PORT = 3306
DATABASE = echat
USER = root
PASSWORD = 123456
OPTION = 67108864
SocketBufferSize = 4096
FetchBufferSize = 100
CHARSET = UTF8
-
测试:isql -v echat
版权声明:本文为hanbo622原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。