--创建用户
create user "aaaa"@"localhost" identified by "aaaa";
--查询数据库
show databases;
--使用数据库
use mysql;
--查询表
show tables;
-- 查询用户
select user from user
--修改密码
set password for "aaaa"@"localhost" =PASSWORD("123456");
-- 授权操作
grant insert,update on *.* to "aaaa"@"localhost";
--删除用户
drop user "aaaa"@"localhost";
--登录用户
mysql -u root -p;
--创建数据库
create database xxx;
--删除数据库
delete database xxx;
--创建表
create table student(
id int unsigned not null primary key auto_increment,
name char(10) not null,
age tinyint unsigned not null);
--查看表结构
describe student;
--修改表
alter table student add birthday date;
alter table student drop id;
alter table student add id int unsigned not null primary key auto_increment;
alter table student add tel char(11) default "-";
alter table student rename stu;
--插入数据
insert into stu (name,age,birthday,id,tel)values("zhangsan",18,"2000-1-8",1,"12345678900");
insert into stu (name,age,birthday,id)values("tmh",20,"1998-10-21",2);
insert into stu values("tjx",11,"2007-09-13",3,"15195862719"),("tjx",9,"2009-6-6",4,"18550677518");
--删除表
drop table stu;
--查询表中数据
select * from stu;
select name from stu where id > 2;