How to repair a database by command via ssh.

Your database is operating normally, but one day you receive a message from your database fails, in this article will teach you how to repair damaged database tables via ssh:

– Login SSH,
cd /usr/local/mysql/var/[DBNAME]/

Note: You see [DBNAME] with your database name.

– Stop MySQL server:
/etc/rc.d/init.d/mysql stop
or
/etc/rc.d/init.d/mysqld stop

– Check tables:
myisamchk * .MYI

– Repair tables:
myisamchk -r * .MYI

– Start MySQL:
/etc/rc.d/init.d/mysql start
or
/etc/rc.d/init.d/mysqld start

– You can use mysqlcheck if not stop MySQL
mysqlcheck [DBNAME]

-Repair tables:
mysqlcheck -r [DBNAME]

You can learn more about 2 commands on the command:

Man myisamchk

man mysqlcheck

VN:F [1.9.22_1171]
Rating: 3.7/5 (3 votes cast)

How to repair a database by command via ssh., 3.7 out of 5 based on 3 ratings