Issues With My GoDaddy MySQL Database Server
👤 By azul | 📆
so i just signed up with godaddy LAMP hosting with mysql, when i tried to execute my script, i kept getting this error the script could not connect to the database, i was using "localhost" as the hostname. so that was my error, so what you need to do is login to your web hosting account, click on the mysql link, then click edit on the database you want to connect to, there you will see the configurations. for example:
MySQL Database Information
Status: Setup
Host Name: mydabastexample.db.123456.godaddyhostedresourcedb.com
Database Name: mydatabasename
Database Version: 5.0
Description: just an example
User Name: mydbusername
as you can see, from the example, above the hostname is mydabastexample.db.123456.godaddyhostedresourcedb.com
so thats what you need to use for a hostname when you are trying to connect to mysql database server being hosted on godaddy web hosting account
this is the error i got and i was able to fix it:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/connect.php on line 3
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/content/connect.php on line 3
MySQL Database Information
Status: Setup
Host Name: mydabastexample.db.123456.godaddyhostedresourcedb.com
Database Name: mydatabasename
Database Version: 5.0
Description: just an example
User Name: mydbusername
as you can see, from the example, above the hostname is mydabastexample.db.123456.godaddyhostedresourcedb.com
so thats what you need to use for a hostname when you are trying to connect to mysql database server being hosted on godaddy web hosting account
this is the error i got and i was able to fix it:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/connect.php on line 3
Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/content/connect.php on line 3