MySQL创建用户和授权
MySQL创建用户和授权
-- 语法
create user '用户名'@'主机' identified by '密码';
-- 实例
create user 'rayfoo'@'%' identified by '123456';
-- 刷新,立即生效
flush privileges;
-- 语法
grant all privileges on 数据库.表 to 用户名@'主机' identified by '密码';
-- 实例
grant all privileges on *.* to rayfoo@'%' identified by '123456';
-- 刷新,立即生效
flush privileges;