SQL常用命令

进入MYSQL

docker exec -it mysql bash


连接数据库;

mysql -u  root -p


查看数据库

show databases;


创建数据库

create database 数据库名


查询用户

select user,host from mysql.user;


创建用户

create user '账号'@'%' identified by '密码';


数据库授权

grant all privileges on 数据库名.* to '账户'@'%';


生效命令

flush privileges;

create user 'root'@'%' identified with mysql_native_password by 'root';
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;



关键词:

网友评论

发表评论