1. 程式人生 > >MySQL 8.013重置密碼 windows10 環境

MySQL 8.013重置密碼 windows10 環境

參考自:https://blog.csdn.net/baidu_32363401/article/details/81544573?utm_source=blogxgwz1 

https://blog.csdn.net/qq_33337277/article/details/81454700

的方法二。

但版本不同,有些許差異,首先是:

1)由於mysqld –skip-grant-tables實測在mysql8.0中已失效,現使用mysqld --console --skip-grant-tables --shared-memory

修正他的說法:

這裡使用的指令是“mysqld –shared-memory –skip-grant-tables”,若是隻是“mysqld –skip-grant-tables”的話,會導致mysqld啟動失敗,提示“TCP/IP, –shared-memory, or –named-pipe should be configured on NT OS”錯誤。經過測試,只有加上“–shared-memory”才能啟動、訪問資料庫。

註明:指令“mysqld –shared-memory –skip-grant-tables”在8.013失效 ;

2)ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';  

不能寫成ALTER USER 'root' @ 'localhost' IDENTIFIED BY 'root';