Reputation: 105
I installed LAMP in my newly installed ubuntu 22.04 a few days before and everything was working perfectly. But today when I tried to start mysql It is showing the following error.
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2022-05-01 09:35:16 IST; 19s ago
Process: 6471 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Process: 6479 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Main PID: 6479 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
Error: 2 (No such file or directory)
CPU: 312ms
May 01 09:35:16 g-pc systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
May 01 09:35:16 g-pc systemd[1]: Stopped MySQL Community Server.
May 01 09:35:16 g-pc systemd[1]: mysql.service: Start request repeated too quickly.
May 01 09:35:16 g-pc systemd[1]: mysql.service: Failed with result 'exit-code'.
May 01 09:35:16 g-pc systemd[1]: Failed to start MySQL Community Server.
journalctl shows the following:
May 01 09:35:16 g-pc systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
░░ Subject: Automatic restarting of a unit has been scheduled
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ Automatic restarting of the unit mysql.service has been scheduled, as the result for
░░ the configured Restart= setting for the unit.
May 01 09:35:16 g-pc systemd[1]: Stopped MySQL Community Server.
░░ Subject: A stop job for unit mysql.service has finished
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A stop job for unit mysql.service has finished.
░░
░░ The job identifier is 3436 and the job result is done.
May 01 09:35:16 g-pc systemd[1]: mysql.service: Start request repeated too quickly.
May 01 09:35:16 g-pc systemd[1]: mysql.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit mysql.service has entered the 'failed' state with result 'exit-code'.
May 01 09:35:16 g-pc systemd[1]: Failed to start MySQL Community Server.
░░ Subject: A start job for unit mysql.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit mysql.service has finished with a failure.
░░
░░ The job identifier is 3436 and the job result is failed.
Upvotes: 1
Views: 20261
Reputation: 2643
After an update of the mysql server the #inndb_redo folder didn't get restored for some reason. So as root:
cd /var/lib/mysql
mkdir "#innodb_redo"
chown mysql:mysql #innodb_redo
systemctl restart mysql
Upvotes: 0
Reputation: 21
If this is happening it's likely theres been error during the installation of mysql. If the above don't work try these:
Purge mysql:
sudo apt purge mysql-server mysql-client mysql-common mysql-server-core-*
mysql-client-core-*
Make sure all mysql files are removed:
sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql
Reboot your system and try using
sudo dpkg --configure -a
to make sure your packages aren corrupted or broken and use the
sudo apt install mysql-server --fix-broken
Was running into these issues and this enabled me to install successfully.
Upvotes: 2
Reputation: 105
Finally after hours of trying to figure out problem. This thread solved the issue.
I just run the command sudo chown mysql:mysql -R /var/log/mysql
. That solved the issue.
If you don't have that directory, you can create it and set permissions to write in
$ sudo mkdir -p /var/log/mysql/
$ sudo chown mysql:mysql -R /var/log/mysql
Upvotes: 8