MySQL Client tool

Source: Internet
Author: User
Tags mysql client rehash mysql command line

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
 
   
  
  1. mysql> select database();
  2. +------------+
  3. | database() |
  4. +------------+
  5. | mysql |
  6. +------------+
Mode 1: Interactive mode mode 2: Batch mode or SQL script pattern mode 1, execute # vim test.sql on MySQL command line
 
   
  
  1. create database testdb2;
  2. use testdb2;
  3. 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
 
   
  
  1. mysql>   \R mysql> 
  2. 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
 
   
  
  1. # mysqladmin crate test1 create test2
2) Drop Databse_name  
 
   
  
  1. # mysqladmin drop testdb2 drop testdb3
3)processlist
  
 
  1. # mysqladmin processlist
  2. +----+------+-----------------+----+---------+------+ -------+------------------+
  3. | id | user | host             | db | command | time | state | info             |
  4. +----+------+-----------------+----+---------+------+-------+------------------+
  5. | 33 | root | localhost:50637 |    | Query   | 0    |       | show processlist |
  6. +----+------+-----------------+----+---------+------+-------+------------------+
4) Status
  
 
  1. # mysqladmin status
  2. 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
 
   
  
  1. # mysqladmin status --sleep 3 --count 5
5) Extended-status: Display state variables
 
   
  
  1. # mysqladmin extended-status | less
6) Variables: Display server variables
 
   
  
  1. # mysqladmin variables | less
7)flush-privileges: Let mysqld reread authorization form, equivalent to reload;
 
   
  
  1. # 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
 
   
  
  1. mysqladmin kill 50
  2. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.