mysql 某个数据库看不到 给用户权限 设置指定用户访问指定数据库
1、ALTER USER 'user_name'@'host' IDENTIFIED BY 'password';
创建用户:
- user_name 用户名;
- host 允许访问的主机,(%:允许全部;127.0.0.* ip段)
- passwrod 密码
2、GRANT SELECT, INSERT, UPDATE, REFERENCES, DELETE, CREATE, DROP, ALTER, INDEX, TRIGGER, CREATE VIEW, SHOW VIEW, EXECUTE, ALTER ROUTINE, CREATE ROUTINE, CREATE TEMPORARY TABLES, LOCK TABLES, EVENT ON `user_name`.* TO 'db_test'@'%';
设置用户 数据库 权限
3、GRANT GRANT OPTION ON `db_test`.* TO 'user_name'@'%';
4、flush privileges;
刷新缓存