今天用SQLyog连接自己的测试MariaDB数据库时提示
host “ip” is not allowed to connect to this MariaDB server
是为权限不够。
登录数据库
mysq -u root -p
然后设定可远程连接的ip
1.不限制ip
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
// %:表示从任何主机连接到mysql服务器
FLUSH PRIVILEGES;
2.限制仅该ip可连接
GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.248.174.214' IDENTIFIED BY 'password' WITH GRANT OPTION;
//表示从指定ip从任何主机连接到mysql服务器
FLUSH PRIVILEGES;
thanks~!