The Following command can be used to check and repair all MySQL databases on a Ubuntu or Debian Linux System.
Ubuntu Linux
sudo mysqlcheck --defaults-file=/etc/mysql/debian.cnf --auto-repair --optimize --all-databases
Debian Linux
mysqlcheck --defaults-file=/etc/mysql/debian.cnf --auto-repair --optimize --all-databases
The benefit of the above command is that it uses the debian-sys-maint login to MySQL which is available on every Debian and Ubuntu System, so you don't have to provide the MySQL root login details.
How To Check And Repair All MySQL Databases on Debian And Ubuntu Linux
Hi there,
Thank you for providing a possible solution on how to repair the Mysql.
However when trying to use the above command in terminal, i get the following message.
mysqlcheck: Got error: 2002: Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2) when trying to connect
Could you please help me out a bit? 🙂
I have tried out various websites about this topic, uninstalled and reinstalled mysql again without any luck.
I’m using the Linux mint 17.3 (Rosa) OS and I’m a so called Newbie in the Linux world.
Maybe the solution is to delete the OS entirely and reinstall it?
Thank you in advance
Regards Laryea