1. 添加用户
CREATE USER `vipsoft`@`%` IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER;
2. 权限配置
GRANT 权限1,权限2,…权限n ON 数据库名称.表名称 TO 用户名@用户地址 IDENTIFIED BY '连接口令'; # 指定 vipsoft 用户,有XX库的查询、添加权限 GRANT SELECT,INSERT ON `DatabaseName`.* TO `vipsoft`@`%`; # 指定 vipsoft 用户,有XX库的所有权限 GRANT ALL PRIVILEGES ON `DatabaseName`.* TO `vipsoft`@`%`; # 查看 用户的权限 SHOW GRANTS FOR `vipsoft`@`%`;
问题
Error Code : 1044 Access denied for user 'root'@'%' to database 'tableName'
SELECT HOST,USER,grant_priv,super_priv FROM mysql.user
UPDATE mysql.user SET Grant_priv='Y',Super_priv='Y' WHERE USER = 'root' AND HOST = '%'; FLUSH PRIVILEGES;
再次查询,grant_priv = Y