mysql常用命令
2016-01-23 19:21
666 查看
建表和建数据库与sql中一样,
增删改查与sql也一样
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| db_1 |
| db_11 |
| db_2 |
| db_3 |
| db_6 |
| db_7 |
| db_8 |
| db_9 |
| mysql |
| performance_schema |
| sakila |
| test |
| world |
+--------------------+
14 rows in set (0.00 sec)
mysql> use db_11;
Database changed
mysql> show tables;
+-----------------+
| Tables_in_db_11 |
+-----------------+
| address |
| person |
+-----------------+
2 rows in set (0.00 sec)
mysql>
mysql> show table status \G;
*************************** 1. row ***************************
Name: address
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 0
Auto_increment: NULL
Create_time: 2016-01-23 15:28:17
Update_time: NULL
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
*************************** 2. row ***************************
Name: person
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 0
Auto_increment: NULL
Create_time: 2016-01-23 15:24:59
Update_time: NULL
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
2 rows in set (0.00 sec)
ERROR:
No query specified
mysql> show columns from person;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.01 sec)
mysql>
mysql> show procedure status \G;
*************************** 1. row ***************************
Db: sakila
Name: film_in_stock
Type: PROCEDURE
Definer: root@localhost
Modified: 2015-08-17 19:25:35
Created: 2015-08-17 19:25:35
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: utf8_general_ci
*************************** 2. row ***************************
Db: sakila
Name: film_not_in_stock
Type: PROCEDURE
Definer: root@localhost
Modified: 2015-08-17 19:25:35
Created: 2015-08-17 19:25:35
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: utf8_general_ci
*************************** 3. row ***************************
Db: sakila
Name: rewards_report
Type: PROCEDURE
Definer: root@localhost
Modified: 2015-08-17 19:25:35
Created: 2015-08-17 19:25:35
Security_type: DEFINER
Comment: Provides a customizable report on best customers
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: utf8_general_ci
3 rows in set (0.01 sec)
ERROR:
No query specified
mysql> show columns from address;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| road | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.01 sec)
mysql> show table status like 'address' \G;
*************************** 1. row ***************************
Name: address
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 0
Auto_increment: NULL
Create_time: 2016-01-23 15:28:17
Update_time: NULL
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.00 sec)
ERROR:
No query specified
mysql>
mysql> select database(); //////查看当前使用的是哪个数据库
+------------+
| database() |
+------------+
| db_11 |
+------------+
1 row in set (0.04 sec)
增删改查与sql也一样
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| db_1 |
| db_11 |
| db_2 |
| db_3 |
| db_6 |
| db_7 |
| db_8 |
| db_9 |
| mysql |
| performance_schema |
| sakila |
| test |
| world |
+--------------------+
14 rows in set (0.00 sec)
mysql> use db_11;
Database changed
mysql> show tables;
+-----------------+
| Tables_in_db_11 |
+-----------------+
| address |
| person |
+-----------------+
2 rows in set (0.00 sec)
mysql>
mysql> show table status \G;
*************************** 1. row ***************************
Name: address
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 0
Auto_increment: NULL
Create_time: 2016-01-23 15:28:17
Update_time: NULL
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
*************************** 2. row ***************************
Name: person
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 0
Auto_increment: NULL
Create_time: 2016-01-23 15:24:59
Update_time: NULL
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
2 rows in set (0.00 sec)
ERROR:
No query specified
mysql> show columns from person;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| name | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.01 sec)
mysql>
mysql> show procedure status \G;
*************************** 1. row ***************************
Db: sakila
Name: film_in_stock
Type: PROCEDURE
Definer: root@localhost
Modified: 2015-08-17 19:25:35
Created: 2015-08-17 19:25:35
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: utf8_general_ci
*************************** 2. row ***************************
Db: sakila
Name: film_not_in_stock
Type: PROCEDURE
Definer: root@localhost
Modified: 2015-08-17 19:25:35
Created: 2015-08-17 19:25:35
Security_type: DEFINER
Comment:
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: utf8_general_ci
*************************** 3. row ***************************
Db: sakila
Name: rewards_report
Type: PROCEDURE
Definer: root@localhost
Modified: 2015-08-17 19:25:35
Created: 2015-08-17 19:25:35
Security_type: DEFINER
Comment: Provides a customizable report on best customers
character_set_client: utf8
collation_connection: utf8_general_ci
Database Collation: utf8_general_ci
3 rows in set (0.01 sec)
ERROR:
No query specified
mysql> show columns from address;
+-------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| road | varchar(20) | YES | | NULL | |
+-------+-------------+------+-----+---------+-------+
2 rows in set (0.01 sec)
mysql> show table status like 'address' \G;
*************************** 1. row ***************************
Name: address
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 0
Avg_row_length: 0
Data_length: 16384
Max_data_length: 0
Index_length: 0
Data_free: 0
Auto_increment: NULL
Create_time: 2016-01-23 15:28:17
Update_time: NULL
Check_time: NULL
Collation: utf8_general_ci
Checksum: NULL
Create_options:
Comment:
1 row in set (0.00 sec)
ERROR:
No query specified
mysql>
mysql> select database(); //////查看当前使用的是哪个数据库
+------------+
| database() |
+------------+
| db_11 |
+------------+
1 row in set (0.04 sec)
相关文章推荐
- Mysql加入用户时的错误问题
- mysql的utf8mb4设置
- 安装和启动MySQL时遇到的问题总结
- 如果不小心把mysql的权限表删除了恢复方法
- Mysql数据库字符集问题
- 彻底解决mysql中文乱码的办法
- Mysql 漏洞利用(越权读取文件,实战怎么从低权限拿到root密码)[转]
- Mysql数据库字符集问题
- 彻底解决mysql中文乱码的办法
- Mysql 漏洞利用(越权读取文件,实战怎么从低权限拿到root密码)[转]
- MYSQL提权总结
- MySQL忘记密码处理方法
- MYSQL提权总结
- MySQL忘记密码处理方法
- MySQL提权之user.MYD中hash破解方法
- MySQL提权之user.MYD中hash破解方法
- mysql之mof提权详解
- mysql之mof提权详解
- sql2005 和 mysql 定时备份批处理
- sql2005 和 mysql 定时备份批处理