解決 MYSQL 登入時,ERROR 1045 (28000) using password: NO 的方法



我的系統是 UBUNTU 11.04,安裝的MYSQL版本為14.14(注1),安裝好並設定 root 密碼後,透過終端機輸入指令 mysql -u root ,卻出現

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 訊息。

改輸入 mysql -u root -p  強制輸入密碼,卻變成

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

在網路上查詢了一下,發現問題似乎與 'root'@'localhost' ,帳號跟登入位置與密碼對應有關,也發現這問題十分氾濫,並似乎沒有個好的SOP解決流程,於是試了幾種方法,整理成以下心得:

===================================



1.首先,停止MYSQL 服務:

    #  /etc/init.d/mysql stop              or  #  stop mysql          or # service mysql stop

2.接著跳過授權表訪問,命令如下:

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

3.登錄 MYSQL:

    # mysql -uroot mysql   

    or

    # mysql -uroot mysql -p

    輸入 root 密碼,進入MYSQL。

    這裡若依舊跳出 ERROR 1045 (28000) 訊息,則請跳至文末的 A 步驟

4.重新寫入 root 密碼:

    mysql> UPDATE user SET Password=PASSWORD('輸入你 root 的新密碼') where USER='root';

5. 把 所有資料庫(含其下的所有資料表),授權給 root,從 localhost 上來,密碼為引號內數據  '*****'。

    mysql> GRANT all ON *.* TO root@'localhost' IDENTIFIED BY '輸入你 root 的密碼';

6.更新權限!密碼若有更動,一定要執行此行指令。

    mysql> FLUSH PRIVILEGES;

7.離開 MYSQL

    mysql> quit

8.輸入密碼,正常進入 MYSQL。

    # mysql -uroot -p


===================================


A.直接使用 /etc/mysql/debian.cnf 文件中 [client] 提供的用戶名和密碼

    # mysql -udebian-sys-maint -p

    輸入 [client] 中的密碼

    mysql> UPDATE user SET Password=PASSWORD('輸入你 root 的新密碼') where USER='root';
    // 重新寫入 root 密碼

    mysql> GRANT all ON *.* TO root@'localhost' IDENTIFIED BY '輸入你 root 的密碼';
    // 把 所有資料庫(含其下的所有資料表),授權給 root,從 localhost 上來,密碼為引號內數據  '*****'。

    mysql> FLUSH PRIVILEGES;
    // 更新權限!密碼若有更動,一定要執行此行指令。

    mysql> quit

    # mysql -uroot -p

    輸入密碼,正常進入 MYSQL。



===================================




以上兩種狀況我都遇過,依以上方式我的問題都解決了。

另外改好後,MYSQL 系統似乎需要一點時間更動,因為在終端機上MYSQL可進去了,網頁的 phpmyadmin 卻依舊進不去,SSH連也進不去,直到間隔了快 10 秒,才一切正常。










注1: 欲查詢MYSQL版本指令為

    # mysql -V

      查詢PHP 版本指令為

    # php -v

      要注意大小寫喔!





留言

  1. 您好:我執行這個步驟後

    5. 把 所有資料庫(含其下的所有資料表),授權給 root,從 localhost 上來,密碼為引號內數據 '*****'。

    mysql> GRANT all ON *.* TO root@'localhost' IDENTIFIED BY '輸入你 root 的密碼';

    出現:
    ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

    請問,是哪邊有問題??

    回覆刪除
    回覆
    1. 1.service mysqld stop
      2.service mysql start
      3.mysql -uroot -p
      4. GRANT all ON *.* TO root@'localhost' IDENTIFIED BY '輸入你 root 的密碼';
      5.FLUSH PRIVILEGES;

      刪除
  2. 根本看不懂 要在哪裡打阿==????

    回覆刪除
  3. 根本看不懂 要在哪裡打阿==????

    回覆刪除
  4. 如果是根本看不懂的人 就真的無法了 我覺得打得很好 感謝 我解決了。

    回覆刪除
  5. 谢谢,解决了我的问题。
    myblog:http://blog.csdn.net/laoyang360

    回覆刪除
  6. 如果找不到password欄位的,請試試下列sql
    ==================================================================
    UPDATE mysql.user
    SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N'
    WHERE User = 'root' AND Host = 'localhost';

    回覆刪除
  7. Mega Clean Detox Drink is one of the most popular THC detox kits in the market today because it provides value for money and is claimed to be effective. Not only does this d

    回覆刪除
  8. Mega Clean Detox Drink is one of the most popular THC detox kits in the market today because it provides value for money and is claimed to be effective. Not only does this drink cleanse your system of the influence of THC, but it also allows them to eliminate other toxins from your bodies. gooodprgn. However, what we found to be the most impressive feature of this drink is that it contains several essential nutrients that may boost your overall health. My contemplations are based on this input I offer acquire this product, and I will add on my own.You can expect this drink to take effect about three hours after consuming it. So, it does not take very long for this product to start working on your system to get rid of unwanted THC traces. While several users claim this drink helped them pass a drug test, there is no guarantee that it could help you pass yours. However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.

    回覆刪除
  9. Mega Clean Detox Drink is one of the most popular THC detox kits in the market today because it provides value for money and is claimed to be effective. Not only does this drink cleanse your system of the influence of THC, but it also allows them to eliminate other toxins from your bodies. gooodprgn. However, what we found to be the most impressive feature of this drink is that it contains several essential nutrients that may boost your overall health. My contemplations are based on this input I offer acquire this product, and I will add on my own.You can expect this drink to take effect about three hours after consuming it. So, it does not take very long for this product to start working on your system to get rid of unwanted THC traces. While several users claim this drink helped them pass a drug test, there is no guarantee that it could help you pass yours. However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.Mega Clean Detox Drink is one of the most popular THC detox kits in the market today because it provides value for money and is claimed to be effective. Not only does this drink cleanse your system of the influence of THC, but it also allows them to eliminate other toxins from your bodies. gooodprgn. However, what we found to be the most impressive feature of this drink is that it contains several essential nutrients that may boost your overall health. My contemplations are based on this input I offer acquire this product, and I will add on my own.You can expect this drink to take effect about three hours after consuming it. So, it does not take very long for this product to start working on your system to get rid of unwanted THC traces. While several users claim this drink helped them pass a drug test, there is no guarantee that it could help you pass yours. However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.

    回覆刪除
  10. Mega Clean Detox Drink is one of the most popular THC detox kits in the market today because it provides value for money and is claimed to be effective. Not only does this drink cleanse your system of the influence of THC, but it also allows them to eliminate other toxins from your bodies. gooodprgn. However, what we found to be the most impressive feature of this drink is that it contains several essential nutrients that may boost your overall health. My contemplations are based on this input I offer acquire this product, and I will add on my own.You can expect this drink to take effect about three hours after consuming it. So, it does not take very long for this product to start working on your system to get rid of unwanted THC traces. While several users claim this drink helped them pass a drug test, there is no guarantee that it could help you pass yours. However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.Mega Clean Detox Drink is one of the most popular THC detox kits in the market today because it provides value for money and is claimed to be effective. Not only does this drink cleanse your system of the influence of THC, but it also allows them to eliminate other toxins from your bodies. gooodprgn. However, what we found to be the most impressive feature of this drink is that it contains several essential nutrients that may boost your overall health. My contemplations are based on this input I offer acquire this product, and I will add on my own.You can expect this drink to take effect about three hours after consuming it. So, it does not take very long for this product to start working on your system to get rid of unwanted THC traces. While several users claim this drink helped them pass a drug test, there is no guarantee that it could help you pass yours. However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.However, of one thing you can be certain — it will rid your body of THC quicker than you could if you followed natural detox methods or simply let your body’s natural processes take over.

    ваа

    回覆刪除

張貼留言

這個網誌中的熱門文章

解決羅技無線滑鼠找不到驅動,並顯示 USB Receiver 問題

Windows 10 系統更新後,MSI NB 喇叭 爆音/破音/破聲 問題