Today I’m going to explain how you can manage your database with a single command line and, in some cases, gain speed by optimizing it.
First of all, mysqlcheck is a tool that comes with MySQL/MariaDB when you install it, and you have to use it from the command line (SSH).
Analyzing the Database Tables
Analyzing the tables tells us whether a table is fine or has any corrupted parts.
mysqlcheck -u [username] -p --analyze [database_name]Repairing Our Database Tables
Many people don’t know that tables can have problems or be corrupted and need to be repaired. For that we have this command.
mysqlcheck -u [username] -p --repair [database_name]Optimizing the Database Tables
Databases, especially those that hold a lot of data, usually need optimizing to free up space and reorganize the table structure, gaining read/write efficiency.
mysqlcheck -u [username] -p --optimize [database_name]Analyze, Repair and Optimize all databases
These commands are very basic, but I recommend reading the mysqlcheck documentation on the MySQL website.


