首先我们需要先安装vc++2013否则可能出现,找不到msvcr110.dll文件
http://www.microsoft.com/zh-cn/download/details.aspx?id=40784
1.下载(操作系统为Windows Server 2016数据中心版)
https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.19-winx64.zip
2.安装配置
解压完成之后放在C:\Program Files\mysql-5.7.19
添加环境变量
PATH=C:\Program Files\mysql-5.7.19\bin
配置MySQL配置文件C:\Program Files\mysql-5.7.19\my.ini
[mysqld] basedir=C:\Program Files\mysql-5.7.19 datadir=C:\Program Files\mysql-5.7.19\data #bind-address = 127.0.0.1 log-error=C:\Program Files\mysql-5.7.19\data\mysqld.log pid-file=C:\Program Files\mysql-5.7.19\data\mysqld.pid symbolic-links=0 skip-host-cache skip-name-resolve character-set-server=utf8 back_log=50 max_connections = 3000 binlog_cache_size = 4M table_open_cache = 2500 max_connect_errors = 30 max_allowed_packet = 32M max_heap_table_size = 128M sort_buffer_size = 16M thread_cache_size = 16 tmp_table_size = 128M slow-query-log=1 long_query_time = 6 log_queries_not_using_indexes = 1 slow-query-log-file=C:\Program Files\mysql-5.7.19\data\slow.log innodb_buffer_pool_size = 1G innodb_flush_log_at_trx_commit = 1 innodb_log_files_in_group = 2 lower_case_table_names=1 server-id=1 log-bin=mysql-bin sync_binlog = 1 expire_logs_days = 15 #replicate-ignore-db = mysql #replicate-do-db = shop binlog_stmt_cache_size = 1048576 #auto_increment_increment=2 #auto_increment_offset=1 #read_only = 1 [mysql] default-character-set = utf8
初始化数据库
保证C:\Program Files\mysql-5.7.19\data目录有且为空
C:\Program Files\mysql-5.7.19\bin\mysqld --initialize
注册服务
C:\Program Files\mysql-5.7.19\bin\mysqld install
修改密码
mysqld --defaults-file="C:\Program Files\mysql-5.7.19\my.ini" --console --skip-grant-tables UPDATE user SET authentication_string=password("123456"), host="::1" WHERE User="root";
这个密码还不能用,关闭上面启动mysql数据库的窗口,然后启动服务
net start mysql
mysql -uroot -p123456
set password=password("db_password");
时间: 2024-11-10 19:53:14