win7 64位下如何安装配置mysql-5.7.17-winx64

本人综合了两篇文章得以安装成功:

  1. win7 64位下如何安装配置mysql-5.7.4-m14-winx64
  2. the MySQL service on local computer started and then stopped
同时在运行“mysqld --initialize”后,提示错误:
2017-01-06T02:12:51.897566Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.

因此加入上述配置,最后的配置文件my.ini内容请看文章最后。

终于成功启动mysql,却发现“mysql -uroot” 无法连接数据库,报告无法登录。参考mysql how to fix Access denied for user 'root'@'localhost',采取如下步骤:

  1. 停止mysql服务
  2. 以管理员权限打开命令行,把当前目录指向E:\docs\DB\mysql-5.7.17-winx64\bin
  3. 运行
    $ mysqld --skip-grant-tables

  4. 再另外打开命令行,运行
    $ mysql -u root mysql
    $mysql> update user set authentication_string=password('my_password') where user='root';
    $mysql> FLUSH PRIVILEGES;

  5. 退出mysql,重新启动
但是再用HeidiSQL 7.0.0.4053 32 Bit连接数据库,提示密码过期。参考 Mysql password expired. Can't connect,在命令行连接mysql后,运行
SET PASSWORD = PASSWORD('new password');

MySQL server终于正常了。

随后把HeidiSQL 升级到9.4.0.5125,使用正常。


最后的配置文件my.ini内容如下:
[client]
default-character-set=utf8 


[mysqld]
port = 3306 
basedir=E:\docs\DB\mysql-5.7.17-winx64
datadir="E:\docs\DB\mysql-5.7.17-winx64/data/"
tmpdir ="E:\docs\DB\mysql-5.7.17-winx64/data/"
socket ="E:\docs\DB\mysql-5.7.17-winx64/data/mysql.sock"
log-error="E:\docs\DB\mysql-5.7.17-winx64/data/mysql_error.log"


#server_id = 2
#skip-locking


max_connections=100
table_open_cache=256 
query_cache_size=1M


tmp_table_size=32M
thread_cache_size=8


innodb_data_home_dir="E:\docs\DB\mysql-5.7.17-winx64/data/"
innodb_flush_log_at_trx_commit =1
innodb_log_buffer_size=128M
innodb_buffer_pool_size=128M
innodb_log_file_size=10M
innodb_thread_concurrency=16 
innodb-autoextend-increment=1000 
join_buffer_size = 128M
sort_buffer_size = 32M
read_rnd_buffer_size = 32M
max_allowed_packet = 32M 
explicit_defaults_for_timestamp=true
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO"

你可能感兴趣的:(win7 64位下如何安装配置mysql-5.7.17-winx64)