Mysql常用命令的使用
2023-04-21 15:25:04
13638
1.Mysql數(shù)據(jù)庫操作
1.1連接mysql數(shù)據(jù)庫
Mysql - u 用戶名 - p 密碼
1.2查看數(shù)據(jù)庫
Show databases;
1.5 查看數(shù)據(jù)庫里的所有表

1.3創(chuàng)建mysql數(shù)據(jù)庫
Create database 數(shù)據(jù)庫名;

1.4 刪除mysql數(shù)據(jù)庫
Drop database 數(shù)據(jù)庫名

1.5 查看數(shù)據(jù)庫里的所有表

2.mysql表操作
2.1創(chuàng)建表
mysql> create table student(id int,name varchar(20));
Query OK, 0 rows affected (0.01 sec)
2.2 表插入數(shù)據(jù)
mysql> insert into student values(1,'aaa');
Query OK, 1 row affected (0.00 sec)
2.3 查詢表數(shù)據(jù)
mysql> select*from student;
+------+------+ | id | name |
+------+------+ | 1 | aaa |
+------+------+
1 row in set (0.00 sec)
2.4 刪除表中數(shù)據(jù)
mysql> delete from student where id='1';
Query OK,
1 row affected (0.01 sec)
mysql> select*from student;
Empty set (0.00 sec)