简体   繁体   English

MySQL数据库不允许外部连接?

[英]MySQL database not allowing outside connections?

Sorry if this was posted in the wrong area but is there away to get my C# program to connect to my database? 抱歉,如果此消息发布在错误的区域,但是是否可以将我的C#程序连接到数据库? It's not allowing outside connections. 不允许外部连接。 Can you make your database open to connections? 您可以使数据库对连接开放吗? It was installed via Ubuntu 15.04 // PHPMyAdmin 它是通过Ubuntu 15.04安装的// // PHPMyAdmin

string myConnection = "datasource=my_host;port=3306;username=my_user;password=my_pass";
MySqlConnection myConn = new MySqlConnection(myConnection);

I'm trying to create a game launcher and making it check for a password that is hashed in the database. 我正在尝试创建一个游戏启动器,并使其检查数据库中散列的密码。

Go to your phpMyAdmin website and select the "Users" tab at the top. 转到您的phpMyAdmin网站,然后选择顶部的“用户”标签。

Edit Privileges for the user that you want to be able to access the database remotely. 为您希望能够远程访问数据库的用户编辑权限。

Scroll to the bottom, make sure the host setting is set to any host and the textbox says %. 滚动到底部,确保将主机设置设置为任何主机,并且文本框显示%。

Hit "Go" at the bottom to save your changes. 点击底部的“开始”以保存您的更改。

Comment out the bind-address in your my.cnf/my.ini (depending on OS). 注释掉my.cnf / my.ini中的绑定地址(取决于OS)。 Then restart mysql so that the changes to the my.cnf/my.ini file will take affect. 然后重新启动mysql,以使对my.cnf / my.ini文件的更改生效。 You can read more here at DigitalOcean . 您可以在DigitalOcean阅读更多内容。 Now, anyone will be able to connect to your Mysql database remotely as long as they have proper user credentials. 现在,只要拥有正确的用户凭据,任何人都可以远程连接到您的Mysql数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM