Files
sass-admin-agent-api/update_mysql_user.sql

16 lines
844 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 解决方案1修改现有用户的host权限允许从任何IP连接
-- 注意这会允许从任何IP连接安全性较低建议仅在测试环境使用
UPDATE mysql.user SET Host = '%' WHERE User = 'shop_mallnew' AND Host = 'localhost';
FLUSH PRIVILEGES;
-- 或者解决方案2创建一个新用户允许从任何IP连接
-- CREATE USER 'shop_mallnew'@'%' IDENTIFIED BY 'shop_mallnew';
-- GRANT ALL PRIVILEGES ON huawei_shop_mallnew.* TO 'shop_mallnew'@'%';
-- FLUSH PRIVILEGES;
-- 或者解决方案3创建一个新用户仅允许从Docker容器的IP范围连接
-- 假设Docker容器的IP范围是172.17.0.0/16
-- CREATE USER 'shop_mallnew'@'172.17.0.0/255.255.0.0' IDENTIFIED BY 'shop_mallnew';
-- GRANT ALL PRIVILEGES ON huawei_shop_mallnew.* TO 'shop_mallnew'@'172.17.0.0/255.255.0.0';
-- FLUSH PRIVILEGES;