MySQLDatabaseMysqlcheckThe usage of mysqlcheck is the content we will mainly introduce in this article. We know that mysqlcheck is a mysql-provided mysql table that can be checked and repaired, and it can also be optimized and analyzed, the function of mysqlcheck is similar to that of myisamchk, but it works differently.
The main difference is that mysqlcheck must be used when the mysqld server is running, while myisamchk is used when the server is not running. The advantage of using mysqlcheck is that you do not need to stop the server to check or repair tables. Failure to fix myisamchk is irreversible.
1. If you need to check and repair the data tables of all databases, you can use:
- # mysqlcheck -A -o -r -p
- # Enter password:
- database1 OK
- database2 OK
2. If you need to repair the specified database
- # mysqlcheck -A -o -r Database_NAME -p
3. If you use another user name
- # mysqlcheck -A -o -r -p -u admin
- # Enter password:
- database1 OK
- database2 OK
Here admin is the specified mysql user account.
4. If you use the specified mysql. sock to enter the database and fix it
- # mysqlcheck -A -o -r -p -S /tmp/mysql.sock
- # Enter password:
- database1 OK
- database2 OK
Here/tmp/mysql. sock is the path where the specified mysql. sock is stored.
This article describes how to use MySQL database mysqlcheck!