2008年4月21日 星期一

mysql常用指令(一)

1.顯示DATABASE 所有的DB
mysql> SHOW DATABASES;
+-----------------------+
| Database |
+-----------------------+
|information_schema |
| TICP |
| foodmart |
| jasperserver |
| mysql |
| report |
| sowoo |
| sugarcrm |
| test |
+-----------------------+
9 rows in set (0.00 sec)


2. 顯示該 DB 的所有table
mysql> show tables from mysql;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| func |
| help_category |
| user |
| user_info |
+---------------------------+
18 rows in set (0.00 sec)

3. 指定使用某一個DB(這邊以mysql預設的為例)
mysql> USE MYSQL;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

4. 查詢資料
mysql> SELECT USER FROM USER;
+---------------+
| USER |
+--------------+
| jasperdb |
| root |
| root |
| jasperadmin |
| jimmy |
| root |
+--------------+
6 rows in set (0.00 sec)

沒有留言: