mysql用户和数据库

创建数据库:

drop database if exists `xxxx`;

create database `xxxx` 
DEFAULT CHARACTER SET utf8mb4 
COLLATE utf8mb4_general_ci;

show create database `xxxx` ;

alter database `xxxx` default character set 'utf8';

创建用户

create user michael@'%' identified by '123456';

注:% 指任意的远程终端都可以登录

授权用户

grant all privileges 
on databaseName.* 
to userName@"localhost" 
identified by "123456" 
with grant option;

flush privileges; 

猜你喜欢

转载自blog.csdn.net/Michael_lcf/article/details/103388639