[英]Mysql installation error:Unable to set password for the MySQL “root” user
許多人遇到此錯誤,但是沒有提供的解決方案適合我的情況:
在我的ubuntu 14.04服務器中,mysql-server 5.5正常運行,由於某種原因,我們兩個家伙試圖升級到5.6,經過一番混亂的操作,他們失敗了,只有5.6-client,並且安裝了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
那么,如何解決這個問題呢?有什么建議值得贊賞嗎?
做這個:
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
dpkg -l | grep mysql
列出所有已安裝的mysql軟件包,然后為每個條目列出sudo apt-get purge mysql-common
。
如果完成了上述步驟,並且dpkg -l | grep mysql
dpkg -l | grep mysql
已運行,您可以嘗試使用以下命令進行安裝:
sudo apt-get install mysql-server-5.5
我在Ubuntu 16.04 LTS中安裝MySQL 5.6版本時遇到相同的問題。 搜索並與朋友交談后,我弄清楚了如何正確安裝此程序。
首先備份數據庫,然后執行以下命令:
$ 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.