mysql---基础命令

#建库---

create database tay

-> character set=utf8

-> collate=utf8_general_ci;


#建表---

create table student(

-> id int primary key auto_increment,

-> name varchar(20) not null,

-> age int not null,

-> address varchar(50) not null

-> );


#删库---drop database <数据库名>;

#删表---drop table <表名>;


#增---insert into student (name,age,address) values ("孙悟空",25,"花果山");

#删---delete from student where id=1;

#改---update student set name=555,age=555,address=555 where id=53;

#查---select * from student;


#使用shell查询数据库

#---mysql -uroot -pTay123.. -e "use tay;select * from student;"

#使用shell自动添加10万条数据

#---mysql -uroot -pTay123.. -e "use tay;insert into student (name,age,address) values ('${i}',${i},'${i}');"

你可能感兴趣的:(mysql---基础命令)