We are all familiar with the MySQL command line. Below we will introduce you to some commonly used MySQL command line tools, hoping to give you a better understanding of the MySQL command line.
There are some MySQL command line tools available for interaction. Each command accepts some options. The long form of the option is prefixed with two hyphens (-), such as mysql --user=username, and the short form is a single hyphen. Such as mysql -uusername.
The main command line tools provided by MySQL are as follows:
1) msql2mysql
is used to convert applications written in mSQL into MySQL.
2) myisamchk
Verify the integrity of MyISAM tables and fix detected errors.
3) mysql
SQL interpreter for MySQL. SQL can be executed here, terminated with a semicolon or g.
4) mysql_upgrade
After installing a new version of MySQL, you can use it to check the table to determine whether it is compatible with the new version. This command should be run every time you update MySQL.
5) mysqladmin
mysql management interface program. The main tasks are:
⑴create databasename: Create the specified database.
⑵drop databasename: Delete the specified database.
⑶extended-status: Provides extended status messages.
⑷flush-hosts: Flush all cached hosts.
⑸flush-logs: Refresh all logs.
⑹flush-status: Refresh all status variables.
⑺flush-tables: Refresh all tables.
⑻flush-threads: Flush thread buffer.
⑼flush-privileges: Force reload of all authorization tables.
⑽kill id[,id]: Terminate the specified thread.
⑾password new_password: Set a new password.
⑿ping: Verify that mysqld is running.
⒀processlist: Displays activated MySQL threads, which can be terminated using the mysqladmin kill command.
⒁reload: Reload the authorization table.
⒂refresh: Refresh all tables, close all log files, and reopen them.
⒃shutdown: Shut down MySQL.
⒄status: Displays brief server status information.
⒅variables: Output existing variables.
⒆version: Displays the version information of the server.
6) mysqlaccess
The interface for managing users, which can be regarded as a shortcut to the SQL GRANT command.
7) mysqlcheck
A data integrity verification tool that is very similar to myisamchk. The main difference is that this tool can be used while MySQL is running.
8) mysqld
MySQL server process. It is best not to use it directly, but to use mysqld_safe instead.
9) mysqld_safe
Server process manager. Used to start the mysqld server process and restart it if it crashes.
10) mysqldump
Dumps the state of a MySQL database or a collection of databases to a text file to facilitate subsequent database recovery.
11) mysqlimport
Import text files into the database, and their file names need to match the imported tables.
12) mysqlshow
Displays the structure of a specified database object (such as a database, table or column).
13) mysqlslap
A tool to simulate client load on the MySQL server.