MySQL コマンド その1 【初級編 第6回】


MySQL コマンド その1 【初級編 第6回】





mysql> system
mysql> ¥!

 例)mysql> ¥! ls / 
 bin boot dev etc home lib lost+found media misc mnt net opt proc root sbin selinux srv sys tmp usr var 



mysql> status
mysql> ¥s

例) mysql> ¥s
mysql Ver 14.14 Distrib 5.1.58, for redhat-linux-gnu (i686) using readline 5.1

Connection id: 187
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: less -S -X
Using outfile: ”
Using delimiter: ;
Server version: 5.1.58 MySQL Community Server (GPL) by Utter Ramblings
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 3 days 2 hours 7 min 47 sec

Threads: 1 Questions: 7286 Slow queries: 0 Opens: 1587 Flush tables: 1 Open tables: 64 Queries per second avg: 0.27



mysql> help

例)mysql> help
For information about MySQL products and services, visit:
For developer information, including the MySQL Reference Manual, visit:
To buy MySQL Enterprise support, training, or other products, visit:

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  (¥W) Show warnings after every statement.
nowarning (¥w) Don't show warnings after every statement.

For server side help, type 'help contents'

mysql> delimiter

例) mysql> delimiter //



mysql> select user();

例) mysql> select user();

| user()         |
| root@localhost |
1 row in set (0.00 sec)


登録されているユーザ名の表示(mysqlというDB内の userというテーブルに格納されている)

mysql> select user,host from mysql.user;

例)mysql> select user,host from mysql.user;

| user      | host                  |
| user01    | %                     |
| user02    | %                     |
| root      |             |
| root      |         |
|           | localhost             |
| root      | localhost             |
| testuser  | localhost             |
|           | localhost.localdomain |
| root      | localhost.localdomain |
9 rows in set (0.00 sec)



mysql> ¥q
mysql> quit
mysql> exit

例)mysql> ¥q
[root@webserver html]#


  • このエントリーをはてなブックマークに追加