MYSQL5.7 忘记ROOT密码/初始化ROOT密码
生活随笔
收集整理的這篇文章主要介紹了
MYSQL5.7 忘记ROOT密码/初始化ROOT密码
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
編輯my.cnf允許空密碼登錄
1 [root@7Core ~]# vi /etc/my.cnf 2 #在[mysqld]下加入一行 3 skip-grant-tables=1重新啟動(dòng)Mysql服務(wù)
1 [root@7Core ~]# systemctl restart mysqld.service使用Root登錄數(shù)據(jù)庫(kù)、使用mysql數(shù)據(jù)庫(kù)、修改root密碼、退出數(shù)據(jù)庫(kù)
1 [root@7Core ~]# mysql -u root 2 mysql> use mysql; 3 mysql> update user set authentication_string = password('新密碼'),password_last_changed=now() where user='root'; 4 mysql> exit;再次打開(kāi)my.cnf,將skip-grant-tables=1刪掉,保存退出
1 [root@7Core ~]# vi /etc/my.cnf 2 #刪除skip-grant-tables=1重啟Mysql服務(wù)
1 [root@7Core ~]# systemctl restart mysqld.service轉(zhuǎn)載于:https://www.cnblogs.com/wmh1997/p/10895595.html
總結(jié)
以上是生活随笔為你收集整理的MYSQL5.7 忘记ROOT密码/初始化ROOT密码的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: layui 页面保存数据
- 下一篇: vscode 中搭建Vue.js