MYSQLコマンド

12813 ワード

mysql , mysql help mysql 。 Oracle SQL*plus help 。mysql> help  For 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.  -- , ,SQL*plus connect delimiter (\d) Set statement delimiter.                    -- , ;, / edit   (\e) Edit commandwith $EDITOR.                   -- SQL , vi/tmp ego    (\G) Send commandto mysql server, display result vertically.    -- exit   (\q) Exit mysql. Same as quit.                   -- mysqlgo    (\g) Send commandto mysql server.                 -- mysql help   (\h) Display this help.nopager  (
) Disable pager, print to stdout.                -- ,  
notee   (\t) Don't write into outfile.                   -- pager   (\P) Set PAGER [to_pager]. Print the query results via PAGER.    -- pager , more,lessprint   (\p) Print current command.           prompt  (\R) Change your mysql prompt.                   -- mysql quit   (\q) Quit mysql.                             rehash  (\#) Rebuild completion hash.                    --   source  (\.) Execute an SQL script file. Takes a filename 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 forprocessing binlog with multi-byte charsets. -- warnings (\W) Show warnings after every statement.              -- nowarning (\w) Don't show warnings after every statement.-- , , “\”+   For server side help, type'help contents'  -- help contents   -- , --connect mysql> connect chardb localhost;Reading table information forcompletion of table and column namesYou can turn off this feature to get a quicker startup with -A  Connection id:  5Current database: chardb  -- , , , mysql> pager more      -- more PAGER setto 'more'mysql> selecttable_name,table_type,engine from information_schema.tables;  -- mysql> pager tail-5;    -- 5 PAGER setto 'tail -5'mysql> selecttable_name,table_type,engine from information_schema.tables;| setup_timers                 | BASE TABLE | PERFORMANCE_SCHEMA || threads                   | BASE TABLE | PERFORMANCE_SCHEMA || animals                   | BASE TABLE | InnoDB       || shop                     | BASE TABLE | InnoDB       |+----------------------------------------------+-------------+--------------------+92 rows inset(0.02 sec)  mysql> pager;        -- pager PAGER setto 'tail -5'mysql> nopager;       -- ( )pager PAGER setto stdout  --teemysql> tee/tmp/query.log          -- , SQL*plus spoolLogging to file'/tmp/query.log'mysql> selecttable_name,table_type,engine from information_schema.tables;+----------------------------------------------+-------------+--------------------+| table_name                  | table_type | engine       |+----------------------------------------------+-------------+--------------------+| CHARACTER_SETS                | SYSTEM VIEW | MEMORY       || COLLATIONS                  | SYSTEM VIEW | MEMORY       |    .............mysql> notee;                -- , SQL*Plus spool offOutfile disabled.mysql> system tail/tmp/query.log      -- | setup_consumers               | BASE TABLE | PERFORMANCE_SCHEMA || setup_instruments              | BASE TABLE | PERFORMANCE_SCHEMA || setup_timers                 | BASE TABLE | PERFORMANCE_SCHEMA || threads                   | BASE TABLE | PERFORMANCE_SCHEMA || animals                   | BASE TABLE | InnoDB       || shop                     | BASE TABLE | InnoDB       |+----------------------------------------------+-------------+--------------------+92 rows inset(0.02 sec)      -- mysql mysql> prompt SessionA> PROMPT setto 'SessionA> '  -- SessionA> prompt;Returning to default PROMPT of mysql>   -- sql mysql> system morequery.sql  -- , use chardbselect* from tb_isam;mysql> sourcequery.sqlReading table information forcompletion of table and column namesYou can turn off this feature to get a quicker startup with -A  Database changed+------+-------+| id  | value |+------+-------+|  1 | a   ||  2 | b   ||  3 | c   ||  4 | f   |+------+-------+4 rows inset(0.00 sec)  -- mysql> status;--------------mysql Ver 14.14 Distrib 5.5.37, forLinux (x86_64) using readline 5.1  Connection id:     6Current database:    chardbCurrent user:      root@localhostSSL:          Not inuseCurrent pager:     lessUsing outfile:     ''Using delimiter:    ;Server version:     5.5.37-log MySQL Community Server (GPL)Protocol version:    10Connection:       Localhost via UNIX socketServer characterset:  latin1Db   characterset:  utf8Client characterset:  latin1Conn. characterset:  latin1UNIX socket:      /var/lib/mysql/mysql.sockUptime:         3 hours 10 min 59 sec  Threads: 1 Questions: 97 Slow queries: 0 Opens: 313 Flush tables: 1 Open tables: 51 Queries per second avg: 0.008--------------  -- mysql> charset gbk;Charset changedmysql> \s--------------mysql Ver 14.14 Distrib 5.5.37, forLinux (x86_64) using readline 5.1  Connection id:     6Current database:    chardbCurrent user:      root@localhostSSL:          Not inuseCurrent pager:     lessUsing outfile:     ''Using delimiter:    ;Server version:     5.5.37-log MySQL Community Server (GPL)Protocol version:    10Connection:       Localhost via UNIX socketServer characterset:  latin1Db   characterset:  utf8Client characterset:  gbk   --- conn gbk 。Conn. characterset:  gbkUNIX socket:      /var/lib/mysql/mysql.sockUptime:         3 hours 13 min 33 sec  Threads: 1 Questions: 105 Slow queries: 0 Opens: 313 Flush tables: 1 Open tables: 51 Queries per second avg: 0.009--------------  mysql> warnings;Show warnings enabled.mysql> selecs 1;ERROR 1064 (42000): You have an error inyour SQL syntax; check the manual that corresponds to your MySQL server version forthe right syntax to use near 'selecs 1'at line 1mysql> show warnings;+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------+| Level | Code | Message                                                                          |+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------+| Error | 1064 | You have an error inyour SQL syntax; check the manual that corresponds to your MySQL server version forthe right syntax to use near 'selecs 1'at line 1 |+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------+1 row inset(0.00 sec)  mysql> show errors;+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------+| Level | Code | Message                                                                          |+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------+| Error | 1064 | You have an error inyour SQL syntax; check the manual that corresponds to your MySQL server version forthe right syntax to use near 'selecs 1'at line 1 |+-------+------+------------------------------------------------------------------------------------------------------------------------------------------------------------+1 row inset(0.00 sec)  mysql> nowarning;Show warnings disabled.