windows 下 mysql設置初始密碼


1.先在安裝目錄找到my.ini配置文件,打開配置文件,找到[mysqld]一行,在下面添加skip-grant-tables后保存該文件,重新啟mysql動服務。

 

2.執行 mysql -u root -p    密碼為空,直接回車;

usemysql

mysql>update mysql.user set authentication_string=password('123456') where user='root' and Host ='localhost';

 mysql>Flush privileges;

其中newpassword為root的新密碼。

(可能先前的版本密碼的抬頭是password,5.7.11是 authentication_string,可以select * from user,查看一下)

(老版本)update user set password=password("123456") where user="root";

(5.7.11)update user set authentication_string=password("123456") where user="root";


3.將剛才my.ini配置文件添加的那一行去掉,重啟mysql。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM