Summary of basic operations of MYSQL under Ubuntu

1. Log in

mysql -uroot -p
然后输入密码

Insert picture description here

2. View all existing databases

show databases;

Insert picture description here

3. Use a database

use databasesname;

Insert picture description here

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;

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_18431031/article/details/108623842