MYSQL创建用户授权操作
程序员文章站
2022-07-07 18:28:05
...
mysql -u -root -p
-- 允许本地 IP 访问 localhost, 127.0.0.1
CREATE USER 'xxljob'@'localhost' IDENTIFIED BY '123456';
-- 允许外网 IP 访问
CREATE USER 'xxljob'@'%' IDENTIFIED BY '123456';
-- 授权
FLUSH PRIVILEGES;
-- 为用户创建数据库
CREATE DATABASE 'xxljobDB' DEFAULT CHARSET UTF8 COLLATE utf_general_ci;
-- 授予用户通过外网IP对于数据库的全部权限
GRANT ALL PRIVILEGES ON 'xxljobDB'.* TO 'xxljob'@'%' IDENTIFIED BY '123456';
-- 授予用户在本地服务器对该数据库的全部权限
GRANT ALL PRIVILEGES ON 'xxljobDB'.* TO 'xxljob'@'localhost' IDENTIFIED BY '123456';
收回权限
REVOKE Drop ON `axx`.* FROM `tt`@`%`;
-- 允许本地 IP 访问 localhost, 127.0.0.1
CREATE USER 'xxljob'@'localhost' IDENTIFIED BY '123456';
-- 允许外网 IP 访问
CREATE USER 'xxljob'@'%' IDENTIFIED BY '123456';
-- 授权
FLUSH PRIVILEGES;
-- 为用户创建数据库
CREATE DATABASE 'xxljobDB' DEFAULT CHARSET UTF8 COLLATE utf_general_ci;
-- 授予用户通过外网IP对于数据库的全部权限
GRANT ALL PRIVILEGES ON 'xxljobDB'.* TO 'xxljob'@'%' IDENTIFIED BY '123456';
-- 授予用户在本地服务器对该数据库的全部权限
GRANT ALL PRIVILEGES ON 'xxljobDB'.* TO 'xxljob'@'localhost' IDENTIFIED BY '123456';
收回权限
REVOKE Drop ON `axx`.* FROM `tt`@`%`;
上一篇: String和ByteBuffer互转
下一篇: Mysql 偷懒搞替换