|
#1
|
|||
|
|||
|
Unknown MySQL server host 'localhost' on line 7
I cannot connect to the database because: Unknown MySQL server host 'localhost' (1) I noticed in mysql there is a place at bottom to add a host. But not sure what it wants? Just enter a name? But I already see localhost is added. Does it want a new one made? Now I check the phpmyadmin and it just says server is localhost also for my DB. Like at my old palce it was mysql7.hostname.com I know this ain't the right place but I have asked several forum mods but they will not upgrade my forum account to get into the members section to ask questions in the right place so Ill post them here till then. ![]() viragotechforum.com |
|
#2
|
||||
|
||||
|
|
|
#3
|
|||
|
|||
|
Are you trying to connect to the database from your pc for development?
If so then you need to define your IP address in there. If you use % it means anyone can access from any IP address, given they have the correct username and password If it is an error while viewing the published page in a browser it should work. Check to see ifyou are using the correct username and database name. Remember it will be prefixed with you cpanel account name. |
|
#4
|
||||
|
||||
|
some script installation will require you to enter '127.0.0.1'
this is same as localhost
__________________
Charles Gan Hostgatorreview.org webmaster
|
|
#5
|
|||
|
|||
|
this is the code that CP says to use for said DB. trying to get my form working and no not on my PC.
When I look in phpmyadmin its said the DB is located on localhost. PHP $dbh=mysql_connect ("localhost", "USERNAME", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("DBNAME"); |
|
#6
|
|||
|
|||
|
DOH, was the <> marks around the password
|
|
#7
|
|||
|
|||
its always the simple mistakes
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|