5 Replies - 488 Views - Last Post: 27 April 2010 - 12:08 PM Rate Topic: -----

#1 aniri  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 54
  • View blog
  • Posts: 657
  • Joined: 24-November 09

mysql error on vista?

Posted 27 April 2010 - 03:46 AM

Has anyone encountered mysql server errors on vista and not on xp for the same script?

I've a script that connects to the database and works ok on xp with firefox and ie, but not on vista.

On vista I'm getting the following error:
Custom Message : Connection attempt failed

Error Number : 2005

Error Message : Unknown MySQL server host 'SERVER_NAME' (1)


The SERVER_NAME is set to 'localhost'

Is This A Good Question/Topic? 0
  • +

Replies To: mysql error on vista?

#2 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1003
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: mysql error on vista?

Posted 27 April 2010 - 05:15 AM

The constant obviously just isn't set.

You can check what's set by using print_r(get_defined_constants(true));.
Was This Post Helpful? 1
  • +
  • -

#3 aniri  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 54
  • View blog
  • Posts: 657
  • Joined: 24-November 09

Re: mysql error on vista?

Posted 27 April 2010 - 05:37 AM

But it works on xp..so it has to be set :|
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6053
  • View blog
  • Posts: 23,488
  • Joined: 23-August 08

Re: mysql error on vista?

Posted 27 April 2010 - 06:06 AM

Obvious questions: Is the server running? Is Windows firewall set to allow connections? Is localhost == 127.0.0.1 in your HOSTS file?
Was This Post Helpful? 1
  • +
  • -

#5 Arenlor  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 34
  • View blog
  • Posts: 389
  • Joined: 26-April 06

Re: mysql error on vista?

Posted 27 April 2010 - 11:51 AM

How exactly are you trying to connect to the database? Are you using strings?
mysql_connect('localhost','mysql_user','mysql_password'); //Strings
mysql_connect(localhost,mysql_user,mysql_password); //No strings

Make sure to use strings, other things to check are the port MySQL is listening on, and see if the following works:
mysql_connect('127.0.0.1','mysql_user','mysql_password');

That will see if it's just localhost that is bad, or if the connection is.
Was This Post Helpful? 1
  • +
  • -

#6 RudiVisser  Icon User is offline

  • .. does not guess solutions
  • member icon

Reputation: 1003
  • View blog
  • Posts: 3,562
  • Joined: 05-June 09

Re: mysql error on vista?

Posted 27 April 2010 - 12:08 PM

View Postaniri, on 27 April 2010 - 11:37 AM, said:

But it works on xp..so it has to be set :|

"My new car doesn't have air conditioning"
That's because you didn't ask for it.
"BUT MY OLD ONE DID"

Try checking that the constant is defined as per my code. It's clearly not being expanded either way.

View PostArenlor, on 27 April 2010 - 05:51 PM, said:

How exactly are you trying to connect to the database? Are you using strings?
mysql_connect('localhost','mysql_user','mysql_password'); //Strings
mysql_connect(localhost,mysql_user,mysql_password); //No strings

Make sure to use strings, other things to check are the port MySQL is listening on, and see if the following works:
mysql_connect('127.0.0.1','mysql_user','mysql_password');

That will see if it's just localhost that is bad, or if the connection is.

He's using constants, not meant to be strings.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1