创建数据库
#不指定字符创建
create database wordpress character;
#指定utf8字符创建
create database wordpress character set utf8mb4;
创建用户
#创建用户userwordpress,仅限本机访问,密码123456
create user 'userwordpress'@'localhost' identified by '123456';
#创建用户userwordpress,仅限192.168.10.52访问,密码123456
create user 'userwordpress'@'192.168.10.52' identified by '123456';
#创建用户userwordpress,所有IP可以访问,密码123456
create user 'userwordpress'@'%' identified by '123456';
授权用户
#将数据库wordpress下的所有(*)授权给userwordpress
grant all privileges on wordpress.* to 'userwordpress'@'%';
#最后刷新权限
flush privileges;
一步到位
grant all on wordpress.* to 'userwordpress'@'%' identified by '123456'
flush privileges;
评论区