1. 程式人生 > >PHPstudy裡mysql5.5升級到mysql5.7

PHPstudy裡mysql5.5升級到mysql5.7

我原先phpstudy的mysql版本是mysql5.5的,後邊為了使用mysql5.7的新特性,就需要把phpstudy預設的MySQL升級到MySQL5.7
我下載的版本是:mysql-5.7.22-winx64.zip
1:把原來MySQL備份為MySQL_bak
2:把mysql-5.7.22-winx64.zip解壓到D:\soft\phpstudy\PHPTutorial並改名為MySQL
3:從MySQL_bak裡拷貝一個my.ini放到D:\soft\phpstudy\PHPTutorial\MySQL\bin目錄裡,高版本里my.ini需要放到bin目錄裡
我自己的測試my.ini內容如下:
   [client]
port=3306
[mysql]
default-character-set=utf8

[mysqld]
port=3306
basedir="D:/soft/phpstudy/PHPTutorial/MySQL/"
datadir="D:/soft/phpstudy/PHPTutorial/MySQL/data/"
character-set-server=utf8
default-storage-engine=INNODB
#支援 INNODB 引擎模式。修改為 default-storage-engine=INNODB 即可。
#如果 INNODB 模式如果不能啟動,刪除data目錄下ib開頭的日誌檔案重新啟動。

max_connections=512

query_cache_size=0
tmp_table_size=32M

thread_cache_size=8
myisam_max_sort_file_size=64G
myisam_sort_buffer_size=35M
key_buffer_size=25M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=256K

innodb_additional_mem_pool_size=2M

innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M

innodb_buffer_pool_size=47M
innodb_log_file_size=24M
innodb_thread_concurrency=8
innodb_thread_concurrency=8
innodb_thread_concurrency=8
innodb_thread_concurrency=8
innodb_thread_concurrency=8
innodb_thread_concurrency=8
innodb_thread_concurrency=8
innodb_thread_concurrency=8
innodb_thread_concurrency=8
#新加
innodb_file_per_table = 1
skip-grant-tables = 1 #跳過許可權驗證
log-error = D:/soft/phpstudy/PHPTutorial/MySQL/data/error.log

4:然後已管理員身份執行cmd
   進入這個目錄:D:/soft/phpstudy/PHPTutorial/MySQL/
   cd bin
   初始化mysql
   mysqld --initialize-insecure --user=mysql
   安裝mysql5.7服務
   mysqld –install
   啟動mysql
   net start mysql
   關閉mysql
   net stop mysql

5:登入mysql並修改密碼
  mysql -u root -p
  直接回車,因為配置檔案裡配置了不進行登入驗證
  進入mysql後執行:ALTER USER USER() IDENTIFIED BY 'root';修改root密碼
6:至此,win10下phpstudy的mysql就升級完了

7:把配置檔案裡的skip-grant-tables = 1曲調再重啟mysql