mysqli无法连接数据库

WBOY
Release: 2016-06-23 13:48:50
Original
1311 people have browsed it

服务器上的mysql端口是3307,想用mysqli_connect来调用服务器上的存储过程,但一直提示无法连接上,但同样的服务器、数据库、帐号密码,用mysql_connect却可以连上,请问这是什么问题?

错误代码:
Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2003): Can't connect to MySQL server on '59.63.xxx.xxx:3307' (10060) 


回复讨论(解决方案)

检查下你的mysql是否允许 ip 59.63.xxx.xxx 连接

$db = new MySQLi('server', 'user', 'pwd', '', 0, 
                              '/tem/mysqld.sock')

检查下你的mysql是否允许 ip 59.63.xxx.xxx 连接



mysql数据库就是在这个IP的服务器上。

$mysql_db = mysqli_connect($my_Host, $my_Username, $my_Password,$my_Database);

吧mysqli_connect去掉一个  i  ,变成mysql_connect就能连了,这到底是什么原因啊~~~~~~

$link = mysqli_connect('localhost', 'my_user', 'my_password', 'my_db','3307');这样呢   ,把端口放后面

mysqli_connect ? 别名 mysqli::__construct()相当于
$mysqli = new mysqli('localhost', 'my_user', 'my_password', 'my_db','3307');

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template