简体   繁体   中英

MySQL 5.7 Upgrade error on Ubuntu 16.04

I was just uninstalling nginx and then in that apt-get remove command, I see that mysql-server is updating. Then the update hung up. I killed the "apt-get" process (followed some answer somewhere). Then things kept on happening and the mysql was completely screwed up. I followed @jargonjunkie 's answer here: https://askubuntu.com/questions/763534/cannot-reinstall-mysql-server-after-its-purge also but to no avail. (I have even removed /var/lib/mysql and /etc/mysql).

Here's what happens when I try to start mysql:

root@lamp-512mb-nyc1-01:~/etc/mysql# sudo /etc/init.d/mysql start
[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
failed!

Here's what "systemctl status mysql.service" shows:

root@lamp-512mb-nyc1-01:~/etc/mysql# systemctl status mysql.service
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: activating (start-post) (Result: exit-code) since Tue 2017-10-24 13:40:38 UTC; 13s ago
Process: 21324 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 21315 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 21324 (code=exited, status=1/FAILURE);         : 21325 (mysql-systemd-s)
Tasks: 2
Memory: 18.2M
  CPU: 423ms
CGroup: /system.slice/mysql.service
       └─control
         ├─21325 /bin/bash /usr/share/mysql/mysql-systemd-start post
         └─21357 sleep 1

Oct 24 13:40:38 lamp-512mb-nyc1-01 systemd[1]: Starting MySQL Community Server...
Oct 24 13:40:38 lamp-512mb-nyc1-01 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE

I have seen several questions related to mysql-server 5.7 upgrade on ubuntu, but couldn't find anything that worked. Please help. Thanks in advance.

Save your data (/var/lib/mysql) and totally remove MySQL:

  1. apt purge mysql* mariadb*
  2. Remove files files from /var/lib/mysql , /etc/mysql , /lib/systemd/system/mysql.service , /usr/share/mysql
  3. Install MySQL again
  4. Check if it starts
  5. Bring data back (if needed)
  6. Check logs journalctl -xe

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM