国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 數(shù)據(jù)庫(kù) > MySQL > 正文

Mysql5.7忘記root密碼及mysql5.7修改root密碼的方法

2024-07-24 13:08:43
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
這篇文章主要介紹了Mysql5.7忘記root密碼及mysql5.7修改root密碼的方法的相關(guān)資料,需要的朋友可以參考下
 

關(guān)閉正在運(yùn)行的 MySQL :

[root@www.woai.it ~]# service mysql stop

運(yùn)行

[root@www.woai.it ~]# mysqld_safe --skip-grant-tables &

為了安全可以這樣禁止遠(yuǎn)程連接:

[root@www.woai.it ~]# mysqld_safe --skip-grant-tables --skip-networking &

使用mysql連接server:

[root@www.woai.it ~]# mysql -p

更改密碼:

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

*特別提醒注意的一點(diǎn)是,新版的mysql數(shù)據(jù)庫(kù)下的user表中已經(jīng)沒(méi)有Password字段了

而是將加密后的用戶(hù)密碼存儲(chǔ)于authentication_string字段

mysql> flush privileges;mysql> quit;

修改完畢。重啟

[root@localhost ~]# service mysql restart

然后mysql就可以連接了

但此時(shí)操作似乎功能不完全,還要alter user…

mysql> alter user 'root'@'localhost' identified by '123';

這樣也可以:

mysql> set password for 'root'@'localhost'=password('123');

重點(diǎn)給大家介紹下mysql 5.7 root密碼修改

MySQL管理者密碼設(shè)置或修改:

依據(jù)官方說(shuō)明5.6以后版本,第一次啟動(dòng)時(shí)會(huì)在root目錄下生產(chǎn)一個(gè)隨機(jī)密碼,文件名.mysql_secret。

[root@bright ~]# cat /root/.mysql_secret# Password set for user 'root@localhost' at 2015-03-27 23:12:10:Jj+FTiqvyrF[root@bright ~]# cd /usr/local/mysql/bin/[root@bright bin]# ./mysqladmin -u root -h localhost password '123456' -p

Enter password: #此行輸入.mysql_secret里第二行內(nèi)容

mysqladmin: [Warning] Using a password on the command line interface can be insecure.Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

官方的方式,筆者無(wú)論是否使用--skip-grant-tables啟動(dòng)mysql都測(cè)試失敗,親們可以測(cè)試:

shell>mysql -uroot -p'password' #password即.mysql_secret里的密碼mysql>SET PASSWORD = PASSWORD('newpasswd');

Mysql5.7忘記root密碼及mysql5.7修改root密碼的方法

舊版本,安裝后ROOT無(wú)密碼,按如下操作:

方法一:

shell>service mysqld stop #停止mysql服務(wù)shell>mysqld_safe --skip-grant-tables & #以不啟用grant-tables模式啟動(dòng)mysqlshell>mysql -uroot -p #輸入命令回車(chē)進(jìn)入,出現(xiàn)輸入密碼提示直接回車(chē)。mysql>use mysql;mysql>update user set password=PASSWORD("123456")where user="root"; #更改密碼為 newpassordmysql>flush privileges; #更新權(quán)限mysql>quit #退出

方法二:

shell>service mysqld stop #停止mysql服務(wù)shell>mysqld_safe --skip-grant-tables & #以不啟用grant-tables模式啟動(dòng)mysqlshell>mysql -uroot -p #輸入命令回車(chē)進(jìn)入,出現(xiàn)輸入密碼提示直接回車(chē)。mysql > set password for root@localhost = password('mysqlroot');

方法三:

shell>/path/mysqladmin -u UserName -h Host password 'new_password' -p


注:相關(guān)教程知識(shí)閱讀請(qǐng)移步到MYSQL教程頻道。
發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 仙桃市| 南部县| 偃师市| 澜沧| 米脂县| 县级市| 寻甸| 武汉市| 葵青区| 彰化市| 莱阳市| 枣强县| 兴山县| 青河县| 康保县| 武宣县| 伊春市| 丰原市| 武安市| 云浮市| 巨野县| 大邑县| 苍梧县| 弋阳县| 泾阳县| 新野县| 察隅县| 井陉县| 伊春市| 岳西县| 凤凰县| 奉节县| 定边县| 合江县| 黑河市| 若尔盖县| 旅游| 沂源县| 新蔡县| 梁山县| 乳源|