2

so recently new errors started to show after I reinstalled the directory /etc/mysql The directory looks correct after I reinstalled it using the process showing here, I used the method "Recover a removed Directory". Now I have issues started the MySQL server itself, I don't want to uninstall or reinstall the database because I am scared of losing files. I'll provide all details needed to try and solve this in a safe method.

Error Details:

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sat 2019-12-21 16:59:38 EST; 5ms ago
  Process: 3942 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 3941 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
  Process: 3933 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 3941 (code=exited, status=2)

Dec 21 16:59:38 ns529730 systemd[1]: Failed to start MySQL Community Server.
Dec 21 16:59:38 ns529730 systemd[1]: mysql.service: Unit entered failed state.
Dec 21 16:59:38 ns529730 systemd[1]: mysql.service: Failed with result 'exit-code'.
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mysql-server-5.7
E: Sub-process /usr/bin/dpkg returned an error code (1)

systemctl status command showing:

root@ns529730:~# 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 Sat 2019-12-21 17:10:40 EST; 14s ago
  Process: 6727 ExecStart=/usr/sbin/mysqld (code=exited, status=2)
  Process: 6720 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 6727 (code=exited, status=2);         : 6728 (mysql-systemd-s)
   Memory: 15.0M
      CPU: 327ms
   CGroup: /system.slice/mysql.service
           └─control
             ├─6728 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─6784 mysqladmin ping

Dec 21 17:10:40 ns529730 systemd[1]: Starting MySQL Community Server...
Dec 21 17:10:41 ns529730 systemd[1]: mysql.service: Main process exited, code=exited, status=2/INVALIDARGUMENT

System: Ubuntu 16.04 MySQL Version: 5.7

vidarlo
  • 22,691
  • For future reference - unless the error messages are very large it's better to include them on this site as I've edited in now :) That way they'll be visible even if the pastebin you use disappear. – vidarlo Dec 21 '19 at 22:35

1 Answers1

1

Okay, I fixed that by adding innodb_force_recovery = 1 under [mysqld] in my mysqld.cnf File. You can try numbers from 1 to 10 because it may not work first time. Also for people with old mysql versions you should do that on your main config file because old versions have config files in etc/mysql/my.cnf but 5.7 mysql version have them in etc/mysql/mysql.conf.d/mysqld.cnf Answer taken from here. After you do your edits try and start the mysql server using sudo systemctl start mysql