rhel6 mysql skip-grant-tables 添加使用者報錯 ERROR 1290

來源:互聯網
上載者:User

不小心把資料庫密碼忘掉了,

這個時候我們只需要在資料庫的設定檔裡面添加

skip-grant-tables

然後重新啟動服務,再登入資料庫就不要我們輸入密碼了

這個時候我成功登入資料,可是不小心又把所有的使用者給刪除了又無法登陸了,這個時候我又改動設定檔可以登入了想再資料庫裡面添加使用者,可是執行了添加使用者的命令後就提示我如下:

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY '123' WITH GRANT OPTION;
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

這個時候我們只需要flush privileges 一下,在添加使用者就OK了,

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY '123' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

這個時候我們成功搞定了,再登入就可以了。

如果報錯如下資訊:

Error: Cannot retrieve repository metadata (repomd.xml) for repository: InstallMedia. Please verify its path and try again
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

我們只要到/etc/yum.repo.s下面把packetxxxx.repo和RedHat.repo兩個檔案刪除掉,再啟動就可以了,

希望你能搞定,這個問題不是很難多看看錯誤提示資訊就可以了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.