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

首頁 > 數據庫 > MySQL > 正文

mysql Access denied for user ‘root’@’localhost’ (using password: YES)解決方案

2024-07-24 13:07:40
字體:
來源:轉載
供稿:網友

這篇文章主要介紹了mysql Access denied for user ‘root’@’localhost’ (using password: YES)解決方法,本文給出詳細的解決步驟及操作注釋,需要的朋友可以參考下

今天在啟動mysql時出現以下問題:

 

 
  1. [root@www ~]# mysql -u root -p 
  2. Enter password:  
  3. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 

網上的答案是各種各樣的,最終解決問題的方法總結為以下,好多都是沒有設置初始密碼造成此問題的。

解決方法如下:

 

 
  1. [root@www ~]# service mysqld stop #先關閉mysql服務 
  2. Stopping mysqld: [ OK ] 
  3. [root@www ~]# mysql 
  4. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 
  5. [root@www ~]# mysql -u root -p #關閉服務后又出現如下問題 
  6. Enter password:  
  7. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 
  8. [root@www ~]# mysql -u root mysql #鍵入此命令進入mysql 
  9. Reading table information for completion of table and column names 
  10. You can turn off this feature to get a quicker startup with -A 
  11. Welcome to the MySQL monitor. Commands end with ; or /g. 
  12. Your MySQL connection id is 1 
  13. Server version: 5.1.73 Source distribution 
  14. Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 
  15. Oracle is a registered trademark of Oracle Corporation and/or its 
  16. affiliates. Other names may be trademarks of their respective 
  17. owners. 
  18. Type 'help;' or '/h' for help. Type '/c' to clear the current input statement. 
  19. mysql> update user set password=password('123') where user='root' and host='localhost'; ---->修改root的密碼 
  20. Query OK, 1 row affected (0.04 sec) 
  21. Rows matched: 1 Changed: 1 Warnings: 0 
  22. mysql> flush priviledge; 
  23. ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'priviledge' at line 1 
  24. mysql> flush privileges; 
  25. Query OK, 0 rows affected (0.00 sec) 
  26. mysql> /q 
  27. Bye 
  28. [root@www ~]# mysql -u root -p ------>重新進入 
  29. Enter password:  
  30. Welcome to the MySQL monitor. Commands end with ; or /g. 
  31. Your MySQL connection id is 2 
  32. Server version: 5.1.73 Source distribution 
  33. Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 
  34. Oracle is a registered trademark of Oracle Corporation and/or its 
  35. affiliates. Other names may be trademarks of their respective 
  36. owners. 
  37. Type 'help;' or '/h' for help. Type '/c' to clear the current input statement. 
  38. mysql> /q 
  39. Bye 

到此就完了!!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 新野县| 新余市| 六盘水市| 渝中区| 惠来县| 元朗区| 内江市| 利津县| 沙湾县| 浮梁县| 惠东县| 沅陵县| 英德市| 达拉特旗| 麻栗坡县| 方正县| 阿拉善左旗| 隆德县| 金塔县| 汝州市| 沽源县| 砀山县| 西丰县| 锡林浩特市| 嵩明县| 元谋县| 铜陵市| 乐至县| 南平市| 紫阳县| 彩票| 青海省| 旬邑县| 双江| 大埔区| 沅陵县| 沅陵县| 临夏县| 通道| 裕民县| 东乡|