1. Log in
mysql -uroot -p
然后输入密码
2. View all existing databases
show databases;
3. Use a database
use databasesname;
4. View all existing tables in the current database
show tables;
5. Create a new table in the current database
create table if not exists tablename(
id int auto_increment,
a varchar(50) not null,
b varchar(5),
c varchar(10) not null,
d int not null,
e DATE,
primary key(id)
);
6. View the created table structure
desc tablename;
7. Insert data into the table
insert into tablename values ('','','','','','');
8. View the contents of the table after inserting data
select * from tablename;