1. 程式人生 > >PHPStudy升級MySQL

PHPStudy升級MySQL

剛開始學習PHP,下載了PHPStudy,對於其中幾個系統的關係不甚瞭解,因此為加深印象擬手動升級其中各系統,網上有很多資料,有粗有細,依次操作下來仍不成功,對於新手來講,造成一定的疑惑,幾經波折終於解決,為了避免遺忘,以作記錄。

一、備份:將phpstudy內的原MySQL修改資料夾名稱;

二、替換:我下載的是mysql-5.7.17-winx64,因此將該資料夾名稱修改為MySQL,並複製到原MySQL資料夾位置;

三、編輯:編輯MySQL資料夾內的my.ini檔案,內容見後面;

四、CMD:以管理員身份啟動cmd.exe,用cd命令進入mysql\bin目錄,輸入 :mysqld --initialize --console,記錄此過程黑屏顯示的臨時密碼(可使用phpstudy修改密碼),不需要再使用mysqld install命令,該命令用於註冊系統服務,如註冊系統服務會導致phpstudy無法啟動mysql資料庫。

通過以上四步,基本就完成了phpstudy升級mysql的過程。

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.

[mysql] default-character-set=utf8

[mysqld] #skip-grant-tables #跳過授權表啟動 # 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 = C:\\phpStudy\\PHPTutorial\\MySQL datadir = C:\\phpStudy\\PHPTutorial\\MySQL\\data port =3306 #server_id = .....

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 max_connections=20 default-storage-engine=INNODB