MySQL
Mysqldump
MysqladmiinMysqlcheckmysqlimportmysql-u username-h host-p "--protocol {tcp|socket|pipe|memory}--port port-d| --database, specifying the database to be used by default when logging on
Less common options--compress, compression saves bandwidth
--default-character-set=character_name
-v|--version, displaying software version information
-v|--verbose, detailed display of output information
--ssl-ca=/path/to/ssl_ca_file
--ssl-capath=/path/to/ca_dir
--ssl-cert=/path/to/cert_file
--ssl-cipher=cipher_list
--ssl-key=/path/to/key_file
--ssl-verify-server-cert
Description: 1) View the current default database
mysql> select database();
+------------+
| database() |
+------------+
| mysql |
+------------+
Mode 1: Interactive mode mode 2: Batch mode or SQL script pattern mode 1, execute # vim test.sql on MySQL command line
create database testdb2;
use testdb2;
create table student(id int,name char(20),age char(3));
Mysql> Source/root/test/test.sql; Query OK, 1 row Affected (0.00 sec) Database Changedquery OK, 0 rows affected (0.01 sec)
Mode 2, using redirect # MySQL </root/test/test.sql
mysql> Command Two categories:Client command, no statement terminator requiredServer statement: There is a statement terminator, default;\d: Defining a statement Terminator
Client Command Usestatus
\c|clear: Early termination statement execution \r|connect: Reconnect Mysqld\g|go: Regardless of the statement terminator, send this statement directly to the server-side execution; \g|ego: Regardless of the statement Terminator, the statement is sent directly to the server-side execution. And the results are displayed in vertical rows; \!| System command: Execute shell command \w: Displays a warning message after statement execution ends;-r|prompt: Modify command Prompt
mysql> \R mysql>
PROMPT set to ‘mysql> ‘
Name completion function
Use the following options when you connect to MySQL, you can disable name completion-a--no-auto-rehash--disable-auto-rehash under the MySQL client, use the following command to turn on the name of the newly created object \# Rehashmysql output Format Options # mysql--html or-hproduce output in HTML format
--xml or-xproduce output in XML format get server-side commands help keyword more detailed help information in the URL provided below mysqladmin1) create database_name
# mysqladmin crate test1 create test2
2) Drop Databse_name
# mysqladmin drop testdb2 drop testdb3
3)processlist
# mysqladmin processlist
+----+------+-----------------+----+---------+------+ -------+------------------+
| id | user | host | db | command | time | state | info |
+----+------+-----------------+----+---------+------+-------+------------------+
| 33 | root | localhost:50637 | | Query | 0 | | show processlist |
+----+------+-----------------+----+---------+------+-------+------------------+
4) Status
# mysqladmin status
Uptime: 15903 Threads: 1 Questions: $ SlowQueries: 0 Opens: the FlushTables: 1 OpenTables: + Queriesper second AVG: 0.008
--sleep N: Display frequency --count N: Show multiple states
# mysqladmin status --sleep 3 --count 5
5) Extended-status: Display state variables
# mysqladmin extended-status | less
6) Variables: Display server variables
# mysqladmin variables | less
7)flush-privileges: Let mysqld reread authorization form, equivalent to reload;
# mysqladmin flush-privileges
8)flush-status, reset most of the server state variables, set some variables to 09) Flush-logs: binary and Trunk log scrollingFlush-hosts: Due to multiple incorrect connections causing the login to be limited, in order for it to log back in,Clearinternal information and DNS cachingRefresh: Equivalent to simultaneous execution of flush-hosts and Flush-logsShutdown: Shutting down the MySQL server processVersions: Server version and current status information; Kill, pay attention to killing multiple threads, no spaces before and after comma
mysqladmin kill 50
mysqladmin kill 50,55
Start-slave: Start replication, start the replication thread from the server; SQL thread IO Threadstop-slave: Turn off replication;
From for notes (Wiz)
MySQL Client tool