1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| cmd>mysql -uroot -proot
mysql> show databases; 查看有哪些数据库
mysql> use mysql; 进入一个名字为mysql的数据库
mysql> show tables; 查看当前数据库中有哪些表
重要user表 中有哪些内容
mysql> select * from user; 查看表
mysql> desc mysql.user; 查看表结构
primary key 主键
mysql> select host,user,password from mysql.user where user='root';
按条件查询 只看 3个字段 而且其中 user字段值为root的内容
mysql> select host,user,password from mysql.user limit 10;
按条件查询 只看3个字段 而且 只看前10行
mysql> select host,user,password from mysql.user limit 2,2;
从第二行往下看两行 看3,4行
mysql> select host,user,password from user order by 1;
排序查看
|