1.下載安裝包並解壓(免安裝);
2.在安裝目錄下添加my.ini文件,內容如下:
####################配置文件開始###################
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
default-character-set=utf8
[mysqld]
port=3306
basedir ="D:\mysql-5.7.12-winx64/"
datadir ="D:\mysql-5.7.12-winx64/data/"
tmpdir ="D:\mysql-5.7.12-winx64/data/"
socket ="D:\mysql-5.7.12-winx64/data/mysql.sock"
log-error="D:\mysql-5.7.12-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="D:\mysql-5.7.12-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"
skip-grant-tables
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
####################配置文件結束###################
3.在windows系統環境變量path,加入如下內容
D:\mysql-5.7.12-winx64\bin
原理:環境變量裡面的path路徑就是cmd系統的查找目錄路徑。設置了以後就不需要再切換cmd路徑了。
4.以管理員身份運行cmd.exe,進入安裝目錄\bin,並安裝MySQL服務:
D:
cd mysql-5.7.12-winx64
cd bin
mysqld install
注:安裝問題:“發生系統錯誤 193”
解決辦法:D:\mysql-5.7.12-win64\bin 有個mysqld的空文件,刪除即可。
5.初始化
mysqld --initialize
6.啟動mysql:net start mysql
關閉mysql:net stop mysql
7.啟動Mysql客戶端程序,連接MYSQL服務器:
mysql -u root -p
******(密碼)
8.在客戶端程序上的操作:
(1)獲取幫助:help
(2)獲取服務器信息:\s
9.修改配置方式
直接修改my.ini即可。修改後需要重啟MYSQL服務。