mysql 创建用户并授权

创建数据库

create database evildao;

这里用老式加密方式创建密码,防止链接出现问题(在升级mysql8后,默认密码加密方式换掉了,导致了各种连接上的问题,所以才需要加上加密方式指定)

CREATE USER 'evildao_user'@'%' IDENTIFIED WITH mysql_native_password BY 'passwordx';

更新密码

ALTER USER 'evildao_user'@'%' IDENTIFIED WITH caching_sha2_password BY 'new_password';

数据库权限 to 用户

grant all on evildao.* to 'evildao_user';

立即生效

flush privileges;

Last modified on 2019-01-14