MySQL常用命令
1.初始化数据
source …….sql
如:source D:jpowernodejpowernode.sql;
+-----------------------+
| Tables_in_bjpowernode |
+-----------------------+
| dept |
| emp |
| salgrade |
+-----------------------+
2.查看表结构
desc dept
+--------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| DEPTNO | int(2) | NO | PRI | NULL | |
| DNAME | varchar(14) | YES | | NULL | |
| LOC | varchar(13) | YES | | NULL | |
+--------+-------------+------+-----+---------+-------+
3.查询表中数据
mysql> select *from emp;
4.查询当前使用的是哪个数据库
mysql> select database();
+-------------+
| database() |
+-------------+
| bjpowernode |
+-------------+
5.查看mysql的版本号
mysql> select version();
+------------+
| version() |
+------------+
| 5.7.10-log |
+------------+
6.结束一条语句
c
7.退出mysql
mysql> exit
Bye
8.查看创建表的语句
show create table emp;