2017-02-17 23 views
1

很多人都遇到過這樣的錯誤設置的密碼,但沒有提供解決方案,爲我的情況下工作:Mysql的安裝錯誤:無法爲MySQL的「根」用戶

在我的Ubuntu 14.04服務器,MySQL服務器5.5優良工程,出於某種原因,我們兩個人試圖升級到5.6,經過一些混亂的操作,失敗了,只有5.6客戶端和mysql-commn被安裝了,所以我其實不知道他們的詳細操作,然後我嘗試了降級到5.5這樣的:

killall -9 mysql 
killall -9 mysqld 
apt-get purge mysql-* 
remove /etc/myql 
apt-get install mysql-sever-5.5 

得到了一個錯誤:

┌───────────────────────Configuring mysql-server-5.5─────────────────────────┐ 
│ Unable to set password for the MySQL "root" user       │ 
├────────────────────────────────────────────────────────────────────────────┤ 

和安裝日誌是這樣的:

Setting up mysql-server-core-5.5 (5.5.54-0ubuntu0.14.04.1) ... 
Setting up mysql-server-5.5 (5.5.54-0ubuntu0.14.04.1) ... 
170218 2:15:57 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 
170218 2:15:57 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 
170218 2:15:57 [Note] /usr/sbin/mysqld (mysqld 5.5.54-0ubuntu0.14.04.1) starting as process 9038 ... 
start: Job failed to start 
invoke-rc.d: initscript mysql, action "start" failed. 
dpkg: error processing package mysql-server-5.5 (--configure): 
subprocess installed post-installation script returned error exit status 1 
Processing triggers for libc-bin (2.19-0ubuntu6.7) ... 
Errors were encountered while processing: 
mysql-server-5.5 
E: Sub-process /usr/bin/dpkg returned an error code (1) 

錯誤日誌是這樣的:

170218 2:15:57 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './mysql/tables_priv.frm' 
ERROR: 1033 Incorrect information in file: './mysql/tables_priv.frm' 
170218 2:15:57 [ERROR] Aborting 

170218 2:15:57 [Note] /usr/sbin/mysqld: Shutdown complete 

170218 2:15:57 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and 
will be removed in a future release. Please use the full name instead. 
170218 2:15:57 [Note] Plugin 'FEDERATED' is disabled. 
170218 2:15:57 InnoDB: The InnoDB memory heap is disabled 
170218 2:15:57 InnoDB: Mutexes and rw_locks use GCC atomic builtins 
170218 2:15:57 InnoDB: Compressed tables use zlib 1.2.8 
170218 2:15:57 InnoDB: Using Linux native AIO 
170218 2:15:57 InnoDB: Initializing buffer pool, size = 128.0M 
170218 2:15:57 InnoDB: Completed initialization of buffer pool 
InnoDB: Error: log file ./ib_logfile0 is of different size 0 50331648 bytes 
InnoDB: than specified in the .cnf file 0 5242880 bytes! 
170218 2:15:57 [ERROR] Plugin 'InnoDB' init function returned error. 
170218 2:15:57 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed. 
170218 2:15:57 [ERROR] Unknown/unsupported storage engine: InnoDB 
170218 2:15:57 [ERROR] Aborting 

170218 2:15:57 [Note] /usr/sbin/mysqld: Shutdown complete 

那麼,如何解決這個問題的任何建議表示讚賞?

回答

2

這樣做:

sudo -i 
service mysql stop 
killall -KILL mysql mysqld_safe mysqld 
apt-get --yes purge mysql-server mysql-client 
apt-get --yes autoremove --purge 
apt-get autoclean 
deluser --remove-home mysql 
delgroup mysql 
rm -rf /etc/apparmor.d/abstractions/mysql /etc/apparmor.d/cache/usr.sbin.mysqld /etc/mysql /var/lib/mysql /var/log/mysql* /var/log/upstart/mysql.log* /var/run/mysqld 
updatedb 
exit 

您可能還需要dpkg -l | grep mysql列出任何mysql安裝包,然後如每個條目爲sudo apt-get purge mysql-common

如果上述步驟完成後,並沒有mysql引用那裏當dpkg -l | grep mysql運行,你可以嘗試用以下命令進行安裝:

sudo apt-get install mysql-sever-5.5 
+0

謝謝,......注意...........這些操作將刪除數據文件 –

0

我面對在Ubuntu 16.04安裝MySQL的5.6版相同的問題LTS。在與朋友搜索和交談之後,我想出瞭如何安裝這個沒有錯誤。

首先備份數據庫,並按照這個命令:

$ sudo apt-get remove --purge *mysql/* 
$ sudo apt-get autoremove 
$ sudo apt-get autoclean 
$ sudo rm -rf /var/lib/mysql 
$ sudo apt install mysql-server-5.6 
$ sudo apt install mysql-client-5.6