To check all SQL databases, use the following commands:
Check repair and optimize all SQL databases
mysqlcheck --all-databases -r #repair
mysqlcheck --all-databases -a #analyze
mysqlcheck --all-databases -o #optimize
Useful! You can copy this code in a new .sh file and use it as a script, or even automate the optimisation using Cron