沒法啓動MySQL服務,報的錯誤:1067,進程意外終止

昨天,閒着沒事看着mysq本地連接裏有不少數據庫,還有一個mysql,感受不順眼,就刪了它,而後今天我再啓動mysql就出現了這個問題:mysql

我在 datadir的路徑下找到.err文件,查看錯誤緣由:sql

121022 15:21:06 [Note] Plugin 'FEDERATED' is disabled.  
D:\software_builder\mysql\bin\mysqld: Table 'mysql.plugin' doesn't exist  
121022 15:21:06 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.  
121022 15:21:06 InnoDB: The InnoDB memory heap is disabled  
121022 15:21:06 InnoDB: Mutexes and rw_locks use Windows interlocked functions  
121022 15:21:06 InnoDB: Compressed tables use zlib 1.2.3  
121022 15:21:06 InnoDB: Initializing buffer pool, size = 500.0M  
121022 15:21:06 InnoDB: Completed initialization of buffer pool  
121022 15:21:06  InnoDB: Log file .\ib_logfile0 did not exist: new to be created  
InnoDB: Setting log file .\ib_logfile0 size to 100 MB  
InnoDB: Database physically writes the file full: wait...  
InnoDB: Progress in MB: 100  
121022 15:21:07  InnoDB: Log file .\ib_logfile1 did not exist: new to be created  
InnoDB: Setting log file .\ib_logfile1 size to 100 MB  
InnoDB: Database physically writes the file full: wait...  
InnoDB: Progress in MB: 100  
121022 15:21:10 InnoDB: highest supported file format is Barracuda.  
InnoDB: The log sequence number in ibdata files does not match  
InnoDB: the log sequence number in the ib_logfiles!  
121022 15:21:10  InnoDB: Database was not shut down normally!  
InnoDB: Starting crash recovery.  
InnoDB: Reading tablespace information from the .ibd files...  
InnoDB: Restoring possible half-written data pages from the doublewrite  
InnoDB: buffer...  
121022 15:21:10  InnoDB: Waiting for the background threads to start  
121022 15:21:11 InnoDB: 1.1.8 started; log sequence number 3700748  
121022 15:21:11 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

解決辦法數據庫

第一步:在mysql的安裝目錄下 basedir="D:/software_builder/mysql/的data文件夾裏「D:\software_builder\mysql\data」" 下面還有一個mysql的文件夾(如圖),ui

把「mysql文件夾」拷貝到數據庫的數據存放位置的data文件夾下(個人是:C:\ProgramData\MySQL\MySQL Server 5.5\data)spa

而後重啓mysql服務,這時候鏈接本地數據庫,若是正常,則結束,若是報錯:命令行

提示:1045 access denied for user 'root'@'localhost' using password yes

進入命令行,來到mysql的安裝目錄.假設安裝目錄爲 d:\mysql\ , CMD進入命令行
運行 d:\mysql\bin\mysqladmin -u root flush-privileges password "newpassword" 重設root密碼
從新啓動mysql服務code

這時候就正常了orm

相關文章
相關標籤/搜索