1. 程式人生 > >Windows安裝MySQL 5.7.19及相關問題處理

Windows安裝MySQL 5.7.19及相關問題處理

mysql

首先我們需要先安裝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");



本文出自 “楓林晚” 博客,請務必保留此出處http://fengwan.blog.51cto.com/508652/1962785

Windows安裝MySQL 5.7.19及相關問題處理