Windows下MySQL一些錯誤的解決解決方案

來源:互聯網
上載者:User

標籤:windows   mysql   

1.不管它提示什麼,我們都直接看錯誤記錄檔,因為錯誤記錄檔裡面的描述最詳細。

在MySQL的安裝目錄下找到 my.ini設定檔 

看日誌儲存路徑


2.

我的錯誤是[ERROR] Fatal error: Can‘t open and lock privilege tables: Table ‘mysql.host‘ doesn‘t exist

這是因為我手賤了 把庫裡面的mysql 這個表刪掉,所以導致資料庫連接不上。

解決方案:

把Mysql 安裝目錄下的   data  檔案夾裡的mysql檔案夾 copy 到  資料庫的存放路徑中(從my.ini可以看到)


3.然後就觸發了一個問題  Mysql 許可權問題 密碼錯誤

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

解決方案:

編輯mysql設定檔my.ini(不知道在哪請搜尋),在[mysqld]這個條目下加入 skip-grant-tables

儲存退出後重啟mysql

1.點擊“開始”->“運行”(快速鍵Win+R)。

  2.啟動:輸入 net stop mysql

  3.停止:輸入 net start mysql

cmd   mysql -u root -p 斷行符號

1.進入mysql資料庫:

mysql> use mysql;


2.給root使用者佈建新密碼:
mysql> update user set password=password("新密碼") where user="root";


3.重新整理資料庫
mysql> flush privileges;


4.退出mysql:
mysql> quit


修改一下my.ini這個檔案,把我們剛才加入的"skip-grant-tables"這行刪除,儲存退出再重啟mysql就可以了



Windows下MySQL一些錯誤的解決解決方案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.