day2 mysql

mysql -uroot -p 进入数据库
使用查看编码命令:show variables like "%character%"
show databases; 查看数据库
use mysql; 使用数据库
show tables; 查看表
desc table1 ; 查看表的详细信息
select * from user \G; 查看自带的mysql 库中的user 表
create user 'long'@'%' identified by '123456'; 在任何主机登陆
create user 'long'@'127.0.0.1' identified by '123456'; 本台电脑登陆
create user long@localhost identified by '123456'; 本台电脑登陆
grant create, drop on *.* to c08@"%";
user 想看表里面的权限,对所有库改变权限才能看见
user表里面存储的是用户的所有信息
flush privileges;
show grants for c08@"%";
看具体用户的权限
revoke create,drop to *.* from c08@"%"; 移除权限
drop user c08@"%"; 删除普通用户
rename user long@"%" to long1@"%"; 给普通用户改名字
改变表名
•altertable stu  rename stu1;
•renametable stu tostu1 ,age to age1;

猜你喜欢

转载自www.cnblogs.com/Darry-Ring/p/12143021.html