MySQL版本:mysql-5.6.11-win32.zip (社區版)
操作系統:Win7 32bit, 和 Windows 2008 Server 32bit
MySql 的這個版本的安裝與以往稍有不同,記錄以備忘;
1.在Oracle網站上下載MySql,需要注冊
2.解壓到安裝目錄,比如這里是:D:\MySql\mysql5611
3.配置環境變量:新建一個系統變量: MYSQL_HOME, 值:D:\MySql\mysql5611
4.修改MySql啟動配置文件: 將安裝目錄下文件:my-default.ini 重命名為 my.ini
5.修改my.ini, 比如這個:
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/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. [mysql] default-character-set=utf8 [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 = d:\Mysql\mysql5611 datadir = d:\Mysql\mysql5611\data default-storage-engine=MYISAM port=3306 server-id=1 bind-address=0.0.0.0 character-set-server=utf8 # 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
這里需要額外說明的是:
[mysql] default-character-set=utf8
[mysqld]
character-set-server=utf8
這兩個配置是為了保證中文的正常顯示,根據需要修改為你期望的字符編碼
[mysqld] bind-address=0.0.0.0
這個配置是允許通過網絡遠程訪問mysql服務,如果不去要,請刪除此配置項,或者將地址改為:127.0.0.1
6.開始安裝MySql
a) 以管理員身份打開cmd,定位到安裝目錄/bin下
b) 執行安裝: mysqld --install MySql服務名
c) 啟動MySql服務: net start MySql服務名
7. mysql缺省的root密碼為空,修改密碼的一種方法是:
a) mysql -u root -p
b) use mysql
c) update mysql.user set password="new password" where User="root";
d) flush privileges;
修改密碼正確的SQL: SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');