mysql常用命令
来源:互联网 发布:局域网游戏排行榜知乎 编辑:程序博客网 时间:2024/06/18 11:15
建表和建数据库与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)
- MySQL常用命令
- MySql常用命令
- MySQL常用命令
- mysql常用命令
- mysql常用命令
- mysql常用命令
- Mysql常用命令
- MySQL常用命令
- mysql 常用命令
- MySQL常用命令
- mysql常用命令
- MySql常用命令
- MySQL常用命令
- mysql 常用命令
- mysql常用命令
- mysql常用命令
- mysql 常用命令
- MySQL常用命令
- 2、React Native中的flexbox布局
- Java中的流
- leetcode之Palindrome Number
- 老僧长谈设计模式-5-装饰者模式
- poj1703——Find them, Catch them
- mysql常用命令
- 基于socket的TCP、UDP 编程(附带源代码)
- leetcode之Implement Stack using Queues
- Build ffmpeg Libraries in Windows via MinGW
- 面向对象设计原则
- 《剑指offer》——数组中只出现一次的数字
- 1004. 成绩排名 (20)
- leetcode之Intersection of Two Linked Lists
- leetCode 171. Excel Sheet Column Number