日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

MySQL: linux mysql access denied for user ‘root’@’localhost'(using password:YES)

發(fā)布時(shí)間:2025/3/21 数据库 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MySQL: linux mysql access denied for user ‘root’@’localhost'(using password:YES) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

linux安裝完mysql后,使用程序連接報(bào)以上錯(cuò)誤

Access denied for user 'root'@'localhost'?(using password:YES)


解決方法,重新設(shè)置密碼,步驟如下

1.先停掉原來的服務(wù)

service mysqld stop 或者 /etc/init.d/mysql stop

2.使用安全模式登陸,跳過密碼驗(yàn)證

nohup mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

3.登陸

mysql -uroot mysql

4.修改密碼

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

5.刷新權(quán)限

mysql > flush privileges;

6.重新使用正常模式登陸

#mysql -uroot -p #enter password : 123456

可以正常登陸。

7.執(zhí)行其他命令:show databases; 如果提示如下錯(cuò)誤

You must reset your password using ALTER USER statement before executing this statement.

8.重新將密碼設(shè)置一遍即可

mysql > set password = password ('123456');

9.配置完成。

?

如果出現(xiàn) Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

若該路徑下存在.sock文件,開啟一下MySQL服務(wù)即可,/etc/init.d/mysql start

總結(jié)

以上是生活随笔為你收集整理的MySQL: linux mysql access denied for user ‘root’@’localhost'(using password:YES)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。