Koozali.org: home of the SME Server

Legacy Forums => Experienced User Forum => Topic started by: Jorgensen on December 31, 2000, 04:36:54 PM

Title: MySQL via PHP
Post by: Jorgensen on December 31, 2000, 04:36:54 PM
Hi,

I'm am trying to connect to MySQL via PHP, but when I do i get an error. I think I should set up some socket?(Look at the output). But I don't now enough about it, maybe it's my ADSL or maybe it's the e-smith server I should do something whit?

This happens if I use the www url. e.x www.my-site.com

Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) in /home/e-smith/files/primary/html/index.php on line 11
Successfully connected to server

Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) in /home/e-smith/files/primary/html/index.php on line 15

Warning: MySQL: A link to the server could not be established in /home/e-smith/files/primary/html/index.php on line 15
Couldn't open sample:

--------------

And this happens when I use the local e-smith url, www.e.smith.my-site.com

Successfully connected to server
Successfully selected database "sample"

------------


Anybody got an idea?

Regards

Allan
Title: Re: MySQL via PHP
Post by: Tim Litwiller on January 03, 2001, 01:19:32 AM
you should be using localhost if the database and website are on the same server.  By using a named server other than localhost you are running into permissions that won't let an outside site connect to your database.  The other way around that is to add another user to the mysql user database and give permissions to connect from that website name.
Title: Re: MySQL via PHP
Post by: RRX on October 09, 2001, 03:46:09 PM
I also have a problem with it:

when I connect to localhost using root and password everything is OK, but when i place my (php) site on the internet, I get the message:

Warning: MySQL Connection Failed: Access denied for user: 'RRX@localhost' (Using password: YES)

I have made a new user "RRX" and I gave the www.website.com access to the database I use, so I don't understand how I can get it to work :(
Title: Re: MySQL via PHP
Post by: Hybrid on October 17, 2001, 07:44:53 PM
I encountered that kind of problem when setting up an ODBC connection to a mysql database ... to go through, you have to log in as root.