! Why can't I connect to a MYSQL database?

Source: Internet
Author: User
! Why can't I connect to the MYSQL database? the table purchased space is in *** .gotoftp3.com, and the database is in myhostadmin.net. Use the PHP pointer to connect to the database. the database on myhostadmin is displayed as the content of conn. php uploaded on the website is as follows:
@ Mysql_connect ("localhost: 3306", "kingdatape", "*******") or die ("mysql link failed ");
@ Mysql_select_db ("php100") or die ("db link failed ");
@ Mysql_query ("set names 'gbk '");
?> Failed to show as DB link. An error occurred while changing the table name nice nice1. If the user name or password is incorrect, the mysql connection fails. I understand that the database cannot be connected to the table. I used navicatformysql to check the database and found that the database tables are normal. I can't figure out where the problem is. please help me.


Reply to discussion (solution)

Mysql_select_db selects a database instead of a table. As shown in the figure, your database should be kingdatape.

@ Mysql_select_db ("php100") or die ("db link failed ");
Change?
@ Mysql_select_db ("kingdatape") or die ("db link failed ");

Then
@ Mysql_connect ("localhost: 3306 ","?? ? Use? Name ","?? ? Password? ") Or die (" mysql link failed ");

Thank you!

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.