Go Back   HostGator Peer Support Forums > Public Forums > Pre-Sales Questions

Notices

Reply
 
Thread Tools
  #1  
Old 07-18-2007, 01:23 PM
ViragoTech ViragoTech is offline
Junior Croc
 
Join Date: Jul 2007
Posts: 113
Default Unknown MySQL server host 'localhost'

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
Reply With Quote
  #2  
Old 07-18-2007, 01:53 PM
kmaw's Avatar
kmaw kmaw is offline
Emperor Croc
 
Join Date: Mar 2005
Location: Ontario, Canada
Posts: 1,855
Default Re: Unknown MySQL server host 'localhost'

e-mail support@hostgator.com

They're the only ones that can help you with that issue..
Reply With Quote
  #3  
Old 07-18-2007, 01:56 PM
rota919 rota919 is offline
Swamp Croc
 
Join Date: Jan 2007
Location: Armagh, Northern Ireland
Posts: 232
Default Re: Unknown MySQL server host 'localhost'

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.
__________________
Fred
Reply With Quote
  #4  
Old 07-18-2007, 02:47 PM
charlesgan's Avatar
charlesgan charlesgan is offline
Swamp Croc
 
Join Date: Mar 2007
Location: www.hostgatorreview.org
Posts: 350
Default Re: Unknown MySQL server host 'localhost'

some script installation will require you to enter '127.0.0.1'
this is same as localhost
__________________
Charles Gan
Hostgatorreview.org webmaster
Reply With Quote
  #5  
Old 07-18-2007, 06:37 PM
ViragoTech ViragoTech is offline
Junior Croc
 
Join Date: Jul 2007
Posts: 113
Default Re: Unknown MySQL server host 'localhost'

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");
Reply With Quote
  #6  
Old 07-18-2007, 06:45 PM
ViragoTech ViragoTech is offline
Junior Croc
 
Join Date: Jul 2007
Posts: 113
Default Re: Unknown MySQL server host 'localhost'

DOH, was the <> marks around the password
Reply With Quote
  #7  
Old 07-18-2007, 06:51 PM
Sam Sam is offline
Emperor Croc
 
Join Date: Jan 2007
Location: /bin/false
Posts: 3,059
Default Re: Unknown MySQL server host 'localhost'

Quote:
Originally Posted by ViragoTech View Post
DOH, was the <> marks around the password
its always the simple mistakes
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 04:32 AM.

 
Forum SEO by Zoints