连接到我的sql数据库

发布于 2024-11-29 10:48:09 字数 1075 浏览 3 评论 0原文

首先,请注意,连接信息不是正确的信息。我在 1and1 上创建了一个数据库,我想从网络连接到它。我在这里的语法不正确,有人能指出我正确的方向吗?

这是我所得到的:

//connect to DB
$dbc=mysql_connect('http://db232154114.db.1and1.com','db232154114','password');

mysql_select_db('tableName',$dbc)

这是我收到的错误:

Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: 
getaddrinfo failed: No such host is known. in 
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 35

Warning: mysql_connect() [function.mysql-connect]: [2002] php_network_getaddresses: 
getaddrinfo failed: No such host is kn (trying to connect via tcp://http:3306) in 
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 35

Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: 
getaddrinfo failed: No such host is known. in 
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 35

Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in 
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 37

First, let me note that the connection infomation is not the correct info. I made a database on 1and1 and I want to connect to it from the web. I am not getting the syntax correct here, can someone point me in the right direction?

Here is what I have:

//connect to DB
$dbc=mysql_connect('http://db232154114.db.1and1.com','db232154114','password');

mysql_select_db('tableName',$dbc)

Here are the errors that I am getting:

Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: 
getaddrinfo failed: No such host is known. in 
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 35

Warning: mysql_connect() [function.mysql-connect]: [2002] php_network_getaddresses: 
getaddrinfo failed: No such host is kn (trying to connect via tcp://http:3306) in 
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 35

Warning: mysql_connect() [function.mysql-connect]: php_network_getaddresses: 
getaddrinfo failed: No such host is known. in 
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 35

Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in 
C:\xampp\htdocs\ciss225Testing\homework\final_process.php on line 37

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夜声 2024-12-06 10:48:09

尝试将 http://db232154114.db.1and1.com/ 替换为您要连接的 SQL 服务器的 IP 地址

Try to replace http://db232154114.db.1and1.com/ with IP address of SQL server you're connecting to

菊凝晚露 2024-12-06 10:48:09

删除 http:// 并从服务器的 cPanel 等启用远程 MySQL 连接

Remove http:// and enable remote MySQL connections from your server's cPanel or so

情独悲 2024-12-06 10:48:09

你的连接字符串不正确。去掉“http://”的东西;它不是数据库服务器主机名的一部分。

your connection string is not right. get rid of the "http://" stuff; that is not part of the db server's hostname.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文