標籤:
距離上次安裝MySQL已經過去好久了。步驟這些,有可能會忘記。簡單記錄一下吧。(參考了一些網路上的部落格。)
1.mysql-5.7.5-m15-winx64.zip下載
官方網站:
http://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.7-rc-winx64.zip
2.解壓到D:\MySqlDataBase
3.在D:\MySqlDataBase\mysql-5.7.5-m15-winx64下建立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.
# [mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
# basedir = .....
# datadir = .....
# port = .....
# server_id = .....
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
# sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
####################設定檔開始###################
[client]
port=3307
default-character-set=utf8
[mysqld]
port=3307
character_set_server=utf8
basedir ="E:\Database\MySQL\mysql-5.7.7-rc-winx64/"
datadir ="E:\Database\MySQL\mysql-5.7.7-rc-winx64/data/"
tmpdir ="E:\Database\MySQL\mysql-5.7.7-rc-winx64/data/"
socket ="E:\Database\MySQL\mysql-5.7.7-rc-winx64/data/mysql.sock"
log-error="E:\Database\MySQL\mysql-5.7.7-rc-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:\Database\MySQL\mysql-5.7.7-rc-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"
#sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
####################設定檔結束###################
重點是以下配置,其中datadir的目錄名稱必須是:
D:\MySqlDataBase\ mysql-5.7.5-m15-winx64/data/。
4.在windows系統內容變數path,加入如下內容
D:\mysql\mysql-5.7.5-m15-winx64\bin;(注意加分號)
變數名:MYSQL_HOME
變數值:D:\Program Files\mysql-5.7.5-m15-winx64
即為mysql的自訂解壓目錄。
再在Path中添加 %MYSQL_HOME%\bin
5、將mysql註冊為windows系統服務
具體操作是在命令列中執行以下命令(需要以管理員身份運行命令列):
需要切換到bin目錄,否則,會將服務類別目錄指定為C:\Program Files\MySQL\MySQL Server 5.7\mysqld
增加服務命令為:
mysqld install MySQL --defaults-file="D:\mysql\mysql-5.7.5-m15-winx64\my.ini"
移除服務命令為:
mysqld remove
mysqld install MySQL5.7.7 --defaults-file="E:\Database\MySQL\mysql-5.7.7-rc-winx64\my.ini"
mysqld remove MySQL5.7.7
net start MySQL5.7.7
net stop MySQL5.7.7
6.第5步成功後,開啟系統服務管理
可以看到mysql系統服務
在命令列啟動mysql命令為:net start mysql
關閉mysql命令為:net stop mysql
7.修改root的密碼為wenthink
命令列執行:mysql –uroot
mysql>show databases;
mysql>use mysql;
mysql>UPDATE user SET password=PASSWORD(‘wenthink‘) WHERE user=‘root‘;
mysql>FLUSH PRIVILEGES;
mysql>QUIT
遠程登陸配置
允許root使用者在任何地方進行遠程登入,並具有所有庫任何操作許可權,具體操作如下:
1)在本機先使用root使用者登入mysql:
命令列執行:mysql -u root -p
輸入密碼(第7步中設定的密碼):wenthink
2)進行授權操作:
mysql>GRANT ALL PRIVILEGES ON *.* TO‘root‘@‘%‘ IDENTIFIED BY ‘youpassword‘ WITH GRANT OPTION;
重載授權表:
mysql>FLUSH PRIVILEGES;
退出mysql:
mysql>quit
win7 64位下如何安裝配置mysql-5.7.7-rc-winx64