1. Start the service
DOS command
net start mysql 回车
2. Log in to the MySQL database
mysql -uroot -proot 回车
3. View the database in MySQL
show databases;
4. Create a database
create database 数据库名;
After the creation is completed, check whether the creation is successful again through the show databases; command
5. Delete the database
drop database 数据库名;
6. Create Table
Note: Before operating the verse, "use the database"
use 数据库名;
Create table
create table 表名(字段1 数据类型(字符长度) ,字段2 数据类型(长度) not null)
PRIMAPY KEY(字段1);
7 Add a single record in the table
insert into 表名(字段1,字段2.....) valus(值1,值2.......)
Note: Each value corresponds to the type of the field
Reference case screenshot
8. Inquiry
select * from 表名
Refer to the screenshots (I don’t check if data is added after connecting to the top)
9. Add multiple records
insert into 表名(字段1,字段2.....) valus(值A1,值A2.......),(值B1,值AB.......)
Reference screenshot
10. Delete
delete from 表名;
Reference screenshot;
11. Modify
update 表名 set 字段1=值1,字段2=值2.....;
Note that each value and field type correspond
to the screenshot of the reference case