mysql8创建新用户和数据库并授权

2023-07-27 22:23:48
579

```

create database 数据库名 character set utf8;

create user '用户名'@'%' identified with mysql_native_password by '密码';

create user '用户名'@'localhost' identified with mysql_native_password by '密码';

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

```