MySQL创建用户并授权数据库

Uiaoin 2020-08-15 122

1、创建数据库

create database if not exists DATABASE_NAME character set utf8mb4 collate utf8mb4_unicode_ci;


2、创建用户

create user USER_NAME identified by 'PASSWORD';


3、给用户数据库权限

grant all privileges on DATABASE_NAME.* to USER_NAME@'%' identified by 'PASSWORD';
flush privileges;


Done!

加载更多