我search谷歌试图发现如何做到这一点,但本质上我想连接到一个同事的MySQL数据库在Wordpress安装一起工作。
我没有运气,并不断有关于连接不可能的错误:
Unable to connect to any of the specified MySQL hosts. MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts. at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() at MySql.Data.MySqlClient.MySqlPool.GetConnection() at MySql.Data.MySqlClient.MySqlConnection.Open() at Microsoft.WebMatrix.DatabaseManager.MySqlDatabase.MySqlDatabaseProvider.TestConnection(String connectionString) at Microsoft.WebMatrix.DatabaseManager.IisDbManagerModuleService.TestConnection(DatabaseConnection databaseConnection, String configPathState) at Microsoft.WebMatrix.DatabaseManager.Client.ClientConnection.Test(ManagementConfigurationPath configPath) at Microsoft.WebMatrix.DatabaseManager.Client.DatabaseHierarchyInfo.EnsureLoaded()
连接详细信息是从我的同事的连接string中复制的,除了要修改服务器以匹配其机器的IP地址。

我不知道是否有防火墙端口,我必须打开或configuration文件,我不得不修改,但我没有太多的运气,迄今。
(很有可能,默认情况下,web matrix / iis express不会设置它创build的用于接受远程连接的mysql数据库,如果有人知道如何改变这个,那就太好了!)
有人有主意吗?
我在同事的机器上的Windows防火墙上打开了端口3306。
现在我有以下错误:
Host 'DESKTOP019-PC' is not allowed to connect to this MySQL server MySql.Data.MySqlClient.MySqlException (0x80004005): Host 'DESKTOP019-PC' is not allowed to connect to this MySQL server at MySql.Data.MySqlClient.MySqlStream.ReadPacket() at MySql.Data.MySqlClient.NativeDriver.Open() at MySql.Data.MySqlClient.Driver.Open() at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() at MySql.Data.MySqlClient.MySqlPool.GetConnection() at MySql.Data.MySqlClient.MySqlConnection.Open() at Microsoft.WebMatrix.DatabaseManager.MySqlDatabase.MySqlDatabaseProvider.TestConnection(String connectionString) at Microsoft.WebMatrix.DatabaseManager.IisDbManagerModuleService.TestConnection(DatabaseConnection databaseConnection, String configPathState) at Microsoft.WebMatrix.DatabaseManager.Client.ClientConnection.Test(ManagementConfigurationPath configPath) at Microsoft.WebMatrix.DatabaseManager.Client.DatabaseHierarchyInfo.EnsureLoaded()
我想我需要为这个用户授予我的主机名权限,但是由于我不知道数据库在哪里以及如何通过命令行(程序文件中没有适当的MySQL文件夹)来访问它,这将certificate很困难。
位于
Start > All Programs > MySQL > MySQL Server %version% > MySQL Command Line Client
http://forums.iis.net/t/1173668.aspx
findsql客户端后,通过input以下命令来修复连接:
GRANT ALL PRIVILEGES ON databasename.* to 'databaseuser'@'hostname' IDENTIFIED BY 'databasepassword';
http://31bit.com/technology/86-mysql-database/302-how-to-grant-remote-access-to-a-mysql-database
感谢DKNUCKLES的端口推送。 我疯狂地寻找configuration文件和IIS快递的东西,但一个端口打开和授予用户权限是所需要的!
现在我已经连接,通过wordpress获得访问权限。 我得到“错误build立数据库连接”这是一个相当模糊的错误。
我做了一个search,发现一个可以testing连接的页面:
testconnection.php <?php $link = mysql_connect('databaseip_or_localhost', 'databaseuser', 'databasepassword'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?>
我把正确的凭据,添加到我的wordpress安装页面,并访问它。
我得到的消息:
Could not connect: Access denied for user 'wordpressuser457'@'DESKTOP019-PC' (using password: YES)
原来,我写的用户名也错了(我有一个非常漫长的一天) – 它应该是wordpress457user 不是 wordpressuser457 。
当一个愚蠢的东西需要你的时间来寻找时,恨它。
希望这有助于其他任何人在未来做同样的事情。
没有任何额外的信息,我最好的猜测是服务器不允许远程连接。 这可能是由许多原因造成的
MySQL实例没有设置为允许远程连接。 你可以尝试telnet到你的朋友的电脑,看看它是否允许stream量。
telnet 192.168.100.32 3306
这也可能是一个权限问题 – 请参阅此链接的可能原因