成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁技術(shù)文章
文章詳情頁

Linux mysql-5.6如何實(shí)現(xiàn)重置root密碼

瀏覽:16日期:2024-04-11 18:12:58

1. 檢查mysql服務(wù)是否啟動(dòng),如果啟動(dòng),關(guān)閉mysql服務(wù)

運(yùn)行命令:ps -ef | grep -i mysql

Linux mysql-5.6如何實(shí)現(xiàn)重置root密碼

如果開著就運(yùn)行關(guān)閉的命令:service mysqld stop

Linux mysql-5.6如何實(shí)現(xiàn)重置root密碼

2.修改mysql的配置文件my.conf

一般在/etc目錄下,運(yùn)行命令:vi /etc/my.cnf,編輯文件

Linux mysql-5.6如何實(shí)現(xiàn)重置root密碼

在文件的[mysqld]標(biāo)簽下添加一句:skip-grant-tables

Linux mysql-5.6如何實(shí)現(xiàn)重置root密碼

然后wq!保存退出。

3.重啟數(shù)據(jù)庫

運(yùn)行命令:service mysqld start

4.重啟數(shù)據(jù)庫

運(yùn)行命令:service mysqld start

5.進(jìn)入到mysql數(shù)據(jù)庫

運(yùn)行命令:mysql -u root

Linux mysql-5.6如何實(shí)現(xiàn)重置root密碼

6.進(jìn)入到mysql數(shù)據(jù)庫

運(yùn)行命令:mysql -u root

7.修改密碼

 以下是5.6的方式

運(yùn)行語句:use mysql;繼續(xù)運(yùn)行語句:update mysql.user set password=password(’root_password’) where user=’root’; root_password替換成你想要的密碼

以下是5.7的方式

運(yùn)行語句:use mysql;繼續(xù)運(yùn)行語句:update mysql.user set authentication_string=password(’root_password’) where user=’root’; root_password替換成你想要的密碼

Linux mysql-5.6如何實(shí)現(xiàn)重置root密碼

8.把步驟2加的東西刪除掉,在重啟服務(wù)器,就可以使用剛才修改的密碼登錄進(jìn)服務(wù)器了。

mysql -u root -p

到這一步已經(jīng)全部結(jié)束。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: Linux系統(tǒng)
相關(guān)文章: