How to deal with MySQL



If you haveing a trouble with how to do some basic stuff with MySQL, repairing database, optimize or evenr dump and import.. you can find here some useful commands how to do that:


If you have broken database, and you are logged in to your SSH account, you just need to run this command:

mysqlcheck -u user -p –auto-repair –check database

“-u” we use this to say to mysql which user we are using
user – change it for you user of db or your cpanel account if you have cpanel installed on server
“-p” This means that you are gonna have to type password for that account.

This command will repair database that is broken, after that you can optimize your db with this command:

mysqlcheck -u user -p –optimize –check database


For dump/import you can use these commands:

mysqldump -u user -p database -p > backup.sql
mysql -u user -p database < backup.sql


I houp this was helpful.