在使用PHP做为后端链接数据库时出现链接失败

开始使用的是本地数据库本地服务器没有问题,当我上传到云服务器时提示链接失败,查看输出内容以下php

<b>Warning</b>:  mysqli_connect() [<a href='function.mysqli-connect'>function.mysqli-connect</a>]: (HY000/2005): Unknown MySQL server host 'qdm174930306.my3w.com:3306' (1) in <b>/data/home/qxu1590160068/htdocs/tphp/getlist.php</b> on line <b>5</b><br />
链接 MySQL 失败: Unknown MySQL server host 'qdm174930306.my3w.com:3306' (1)<br />
<b>Warning</b>:  mysqli_set_charset() expects parameter 1 to be mysqli, boolean given in <b>/data/home/qxu1590160068/htdocs/tphp/getlist.php</b> on line <b>11</b><br />
<br />
<b>Warning</b>:  mysqli_query() expects parameter 1 to be mysqli, boolean given in <b>/data/home/qxu1590160068/htdocs/tphp/getlist.php</b> on line <b>16</b><br />
<br />
<b>Warning</b>:  mysqli_close() expects parameter 1 to be mysqli, boolean given in <b>/data/home/qxu1590160068/htdocs/tphp/getlist.php</b> on line <b>27</b><br />

后来查了一下,发现把端口号写到后面就能够解决问题mysql

要把端口地址写在最后面
"qdxxxxxxxxxxxxx3w.com","qdm17493045446","miama","qdasdas0306_db","3306"sql

相关文章
相关标签/搜索