MySQL 如何找到MySQL的服务器名称
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4144378/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to find the Server Name of MySQL
提问by Ahmad Farid
Where can I find the name of MySQL which I'll use at the connection string to connect to the database from c#?
在哪里可以找到 MySQL 的名称,我将在连接字符串中使用它从 c# 连接到数据库?
采纳答案by MiSHuTka
"Unhandled Exception: MySql.Data.MySqlClient.MySqlException: Access denied for user 'root'@'sfn-inkubator-70-61.hib.no' (using password: YES)" error means that you have setup connection address correctly. Client connects to server, but server rejects username and password combination.
“未处理的异常:MySql.Data.MySqlClient.MySqlException:用户'root'@'sfn-inkubator-70-61.hib.no' 的访问被拒绝(使用密码:YES)”错误表示您已正确设置连接地址。客户端连接到服务器,但服务器拒绝用户名和密码组合。
So you need to check your server setup, create some user with known password and so on......
所以你需要检查你的服务器设置,创建一些已知密码的用户等等......
回答by warren
If you're connecting to a db on the same server, it should be "localhost
".
如果您连接到同一服务器上的数据库,则它应该是“ localhost
”。
If you are connecting to a remote server, then it should be the FQDN of the remote server (or the IP address) - for example, "dbhost.lan.company.com
".
如果您连接到远程服务器,则它应该是远程服务器的 FQDN(或 IP 地址) - 例如,“ dbhost.lan.company.com
”。
回答by Toby Allen
It's very possible your host blocks external access to your mysql db, quite a few do. This would explain why you can connect via myadmin.
您的主机很可能阻止了对您的 mysql 数据库的外部访问,很多都这样做了。这将解释为什么您可以通过 myadmin 进行连接。