I'm creating a php page (on a godaddy server) which needs to connect to a mysql server and retrieve data from a database. When i run the page i got an error message stating that.
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on **
It says that the error is on the below line,
$conn=mysql_connect($dbhost,$username,$password);
My doubt is,
What needs to be given in place of username and password? Right now i've given the username and password used while creating a new database inside mysql. What am i doing wrong?
Thanks in advance...
On shared go daddy DB's you can't use localhost for the $dbhost
you will need to use the location specified in your godaddy mysql cp
Do not use "localhost" as the hostname for your database-driven websites. Once you have successfully created a database, your host name displays on the Database Information page of your hosting Control Panel.
To Find the Host Name for Your Database
Your database host name displays in the Hostname field.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.