Mysqli cannot connect to the database

Source: Internet
Author: User
Mysqli cannot connect to mysql Port 3307 on the database server. I want to use mysqli_connect to call the stored procedure on the server. However, I have always been prompted that the connection will fail, but the same server, database, and account password will apply, mysql_connect can be connected. what is the problem?

Error code:
Warning: mysqli_connect () [function. mysqli-connect]: (HY000/2003): Can't connect to MySQL server on '59. 63. xxx. xxx: 3307 '(10060)


Reply to discussion (solution)

Check whether your mysql instance allows ip 59.63.xxx.xxx connection.

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

Check whether your mysql instance allows ip 59.63.xxx.xxx connection.



The mysql database is on the server of this IP address.

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

Mysqli_connect removes an I and becomes mysql_connect. why ~~~~~~

$ Link = mysqli_connect ('localhost', 'My _ user', 'My _ password', 'My _ db', '123'); in this way, put the port behind

Mysqli_connect? Alias mysqli ::__ construct () is equivalent
$ Mysqli = new mysqli ('localhost', 'My _ user', 'My _ password', 'My _ db', '123 ');

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.