mysql忘了root密码_mysql忘记root密码怎么办
產(chǎn)品型號(hào):Thinkpad E15
系統(tǒng)版本:centos8
軟件版本:mysql 5.7
mysql忘記root密碼怎么辦
啟動(dòng)MySQL服務(wù)的時(shí)候跳過權(quán)限表認(rèn)證。
停止數(shù)據(jù)庫
[root@xuegod63 ~]# systemctl stop mariadb
直接通過安全模式啟動(dòng)并跳過用戶名認(rèn)證
[root@xuegod63 ~]# mysqld_safe --skip-grant-table? ?&
修改密碼
[root@xuegod63 ~]# mysql
MariaDB [(none)]> update mysql.user set password=password('xuegod') where user='root' and host='localhost';
通過新密碼關(guān)閉數(shù)據(jù)庫
[root@xuegod63 ~]# mysqladmin -uroot -pxuegod shutdown
重新啟動(dòng)數(shù)據(jù)庫
[root@xuegod63 ~]# systemctl start mariadb
注:如果修改配置文件繞過權(quán)限表認(rèn)證,則啟動(dòng)數(shù)據(jù)庫前應(yīng)刪除配置文件中添加的skip-grant-tables。
新密碼登錄數(shù)據(jù)庫
[root@xuegod63 ~]# mysql -uroot -pxuegod
總結(jié):
1、停止數(shù)據(jù)庫
2、通過安全模式跳過安全表啟動(dòng)并修改密碼
3、使用新密碼關(guān)閉數(shù)據(jù)庫后重新啟動(dòng)mysql
總結(jié)
以上是生活随笔為你收集整理的mysql忘了root密码_mysql忘记root密码怎么办的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java 封装表单数据类型_Java基本
- 下一篇: xp中mysql优化_XP加速技巧大盘点