RuoYi-Vue/remote_mysql_access.sql

20 lines
597 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

-- 为root用户添加远程连接权限
USE mysql;
-- 查看当前用户权限
SELECT user, host FROM user;
-- 创建远程访问用户建议使用专用用户而非root
CREATE USER IF NOT EXISTS 'remote_user'@'%' IDENTIFIED BY '123456';
-- 授予远程用户访问权限
GRANT ALL PRIVILEGES ON ry_vue.* TO 'remote_user'@'%' WITH GRANT OPTION;
-- 如果需要让root用户也能远程访问不推荐
-- GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
-- 刷新权限
FLUSH PRIVILEGES;
-- 显示授权结果
SHOW GRANTS FOR 'remote_user'@'%';