The MySQL client tool uses

Source: Internet
Author: User
Tags mysql commands

MySQL client tools in the/usr/local/mysql/bin directory, commonly used clients are: MySQL and mysqladmin


Working mode for MySQL commands: Interactive and scripted

Interactive:

Interactive mode is divided into server-side commands and client commands;

Server-side commands:

for server side help, type  ' help contents ' mysql> help contentsyou  asked for help about help category:  "Contents" for more  information, type  ' help <item> ',  where <item> is one of  the followingcategories:   Account Management       Administration   Compound Statements   Data Definition    Data Manipulation   Data Types   Functions    Functions and Modifiers for Use with GROUP BY    geographic features   help metadata   language structure    plugins   procedures   storage engines   table  maintenance   transactions   user-defined functions   utility 


Client command:

Mysql> helpfor information about mysql products and services, visit :   http://www.mysql.com/for developer information, including the  Mysql reference manual, visit:   http://dev.mysql.com/to buy mysql  Enterprise support, training, or other products, visit:    https://shop.mysql.com/list of all mysql commands:note that all text  commands must be first on line and end with  '; '?           (\?)  Synonym for  ' Help ' .clear      (\c)  clear the current  input statement.connect    (\ r)  Reconnect to the server.  optional arguments are db and host.delimiter  (\d)  Set statement delimiter.edit       (\e)  edit command with $ editor.ego        (\g)  send command to mysql server , display result vertically.exit       (\q)  Exit mysql.  Same as quit.go         (\g)  send command  to mysql server.help       (\h)  Display this  help.nopager    (\ n)  Disable pager, print to stdout.notee       (\ t)  don ' t write into outfile.pager      (\P)  set pager [to_pager]. print the query results via pager.print       (\p)  Print current command.prompt     (\ r)  change your mysql prompt.quit       (\q)  Quit mysql.rehash     (\ #)  Rebuild completion hash.source     (\.)  execute an sql script file. takes a file name as an  argument.status     (\s)  get status information from the  server.system     (\!)  Execute a system shell command.tee        (\ t)  set outfile [to_outfile]. append everything into given outfile.use         (\u)  use another database. takes database  name as argument.charset    (\c)  switch to another charset.  Might be needed for processing binlog with multi-byte  charsets.warnings &nbsp (\w)  Show warnings after every statement.nowarning  (\w)  don ' t  Show warnings after every statement.


Script type:

Syntax format for scripted patterns: MySQL </path/to/script.sql


MySQL command-line options:

-u: Specify login user

-P: Specify the password for the logged-on user

-H: Specifies the host name or IP of the MySQL server

-U: Deny use of the update and delete commands without a WHERE statement

-P: Specifies the listening port of the MySQL server

-e: Specify the command to execute

-E: Query result vertical output (equivalent to \g)

-D: Specify the default database to use for login

-C: Enable compression between server and client connections

-T: Print debug information at exit

-H: Query results are output in HTML format

-x: Query results are output in XML format

--prompt=value: Set MySQL interactive mode prompt (default = mysql>)

--protocol=name: Specifies the protocol used, name can be set to {tcp|socket|pipe|memory}


The MySQL command can read the configuration options in the MY.CNF, and the MySQL default reading order is:

/etc/mysql/my.cnf >/etc/my.cnf > ~/.MY.CNF

For the same configuration options, the last configuration file is valid

For different configuration options, the set of configuration options for three files


Mysqladmin:

mysqladmin [OPTIONS] Command

Common Command options:

-H: Specifies the MySQL server host name or IP

-P: Specify the MySQL server listening port

-U: Specify the logged-on user

-P: Specify the user's password

-C: Enable compression

-C: Specifies the number of executions of the mysqladmin, often in conjunction with option-I

-I: Specify the time to wait between execution commands

Command

Create DatabaseName: Creating a Database

Drop DatabaseName: Delete the database (including all tables)

Extended-status: The extended status of the print server (equivalent to executing show global status;)

Debug: Find debug Log, please write error log

Flush-hosts: Empty host-related cache, including DNS cache, due to excessive number of connection errors and rejected host list

Flush-logs: Log scrolling

Flush-status: Resetting the value of a state variable

Flush-tables: Execute this command before manual lock

Flush-threads: Emptying the thread cache

Flush-privileges: Reload Authorization table (related to reload)

Kill id1,id2...idn: Kill Mysqld Thread

Ping: Test mysqld status

Processlist: View a list of threads

Shutdown: Close mysqld

Status: View mysqld status

Start-slave: Starting from the server process

Stop-slave: Shutdown from server process

Variables: Print variable values





This article is from the "Tiger Shengwei" blog, be sure to keep this source http://tobeone.blog.51cto.com/817917/1576063

The MySQL client tool uses

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.