不允许MySQL进行远程连接 [英] MySQL is not allowed to connect remotely
问题描述
可能重复:
远程mysql连接
我制作了一个C ++应用,需要连接到MySQL db时,其他人连接到MySQL服务器时遇到的错误是:
不允许主机连接到MySQL。
I've made an C++ app, that requires connection to MySQL db, the error others get when connecting to my MySQL server is: Host is not allowed to connect to the MySQL.
我一直在阅读一些解决方案,但是它们要求您拥有用户ip,我如何才能允许从任何PC连接?
I've been reading some solutions on that, but they require you to have the users ip, how could I allow connection from ANY pc?
推荐答案
创建一个以通配符(%)作为主机名的用户。这是一个示例,该示例创建一个名为 my_user的用户并将其所有特权授予 my_database数据库。
Create a user with a wildcard (%) as the host name. Here is an example that creates a user named "my_user" and grants them all privileges to the "my_database" database.
GRANT ALL ON my_database.* TO my_user@'%' IDENTIFIED BY 'some_password';
您可能要考虑授予较少的权限。例如,也许您只需要授予该远程用户SELECT特权。
You may want to consider granting fewer permissions. For example, maybe you only need to give this remote user SELECT privileges.
GRANT SELECT ON my_database.* TO my_user@'%' IDENTIFIED BY 'some_password';
这篇关于不允许MySQL进行远程连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!