如何使用本地主机连接到我的 mysql 服务器?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4578521/
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 can i connect to my mysql server using localhost?
提问by getaway
this might sound stupid, but i never experienced such thing, im developing on my localhost, but i have my server with 1 and1, how can i connect to my database on my server using my localhost, what will the host be? thanks
这可能听起来很愚蠢,但我从未经历过这样的事情,我在我的本地主机上开发,但我的服务器有 1 和 1,我如何使用本地主机连接到我服务器上的数据库,主机是什么?谢谢
采纳答案by Mark Byers
Try just using the string "localhost" as the hostname or the IP address if you know it.
如果您知道,请尝试仅使用字符串“localhost”作为主机名或 IP 地址。
If that doesn't work you could contact the 1 & 1 customer support.
如果这不起作用,您可以联系1 & 1 客户支持。
回答by Tasawer Khan
host will be localhost
or 127.0.0.1
(This is IP address for localhost). I hope it will work
主机将是localhost
或127.0.0.1
(这是本地主机的 IP 地址)。我希望它会起作用
回答by Anup Khandelwal
First, make sure that mysql is actually listening on localhost (127.0.0.1). You may be connecting over your public IP.
首先,确保 mysql 实际上正在侦听 localhost (127.0.0.1)。您可能正在通过您的公共 IP 进行连接。
If you want to test running mysql only on localhost, this quick howto shows you what to put in your /etc/my.cnf
如果您只想在本地主机上测试运行 mysql,此快速操作说明会向您展示在 /etc/my.cnf 中放置的内容
回答by Neigyl R. Noval
Use 'localhost' as your host when connecting between db and localhost. In connecting your server to your database, follow the instructions from your localhost server website.
在 db 和 localhost 之间连接时,使用“localhost”作为主机。在将服务器连接到数据库时,请按照本地主机服务器网站上的说明进行操作。