This is my first time to install Drupal.

I located the files in a directory entitled drupal that is inside my site's root.
When I visited http://www.mydomain.net/drupal, the install started, and then promted me for database configuration.
I have already created a database entitled drupal.
I am assuming that this database configuration page is normal, and that you all have seen it before.

After entering my database name, database username, and database password, I get this error:

"Failure to connect to your MySQL database server. MySQL reports the following message: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2).
• Are you sure you have the correct username and password?
• Are you sure that you have typed the correct database hostname?
• Are you sure that the database server is running?"

I am sure that my database name, username, and password are all correct, but I don't know where to check my hostname. My host is Dreamhost and it runs phpmy admin.

It is very frustrating as I can't think of what could possibly be the issue. I am almost certain all of the permissions for the user are correct, but none of the SQL commands work when I type them in phpmyadmin.

Thanks for reading! I hope someone can help!

Comments

vm’s picture

you may want to fire a support request to your host, who will be able to tell you exactly what the location is however, you can try looking at the very top of phpmyadmin where it says server: it may be set to localhost you can see this by choosing teh database you set up, and the very first line in the right pane should tell you exactly what the address or the mySQL server is.

bobbyswim’s picture

Thanks for your reply!
I fixed it by opening up the settings.php file and changing 'localhost' to my hostname 'mysql.mysite.net'.

Funny how an automated install still requires me to jump in and find something in the code. Oh well. It works now, and all is well!

vm’s picture

Funny how an automated install still requires me to jump in and find something in the code.

localhost would have needed to have been changed during installation, The install script uses localhost as a default but can indeed be changed. Obviously if this is done incorrectly the easiest method is the one you used, altering settings.php.

congrats.

mricha73’s picture

mricha73 - MA

I'm having the same problem on Dreamhost.

In sites/default/settings.php I changed 'localhost' to my hostname (mysql.myurl.us), but it didn't seem to work. Is there another settings.php that I missed? Do I need to change all of the 'localhost' values in install.php to my hostname also?

flashon’s picture

If you are getting stuck at the database configuration step in your installation it may just be as simple as entering your hostname in 'Advanced Options'. You shouldn't have to mess with settings.php if your using Drupal 5.1. If this is the case don't forget to replace the settings.php file you altered.

thescoutingsource’s picture

I'm having the same issue on my local machine. I know the username and password are correct. If I use CocoaMySQL I can login just fine but when I enter this information on the install I get this same message. Any Ideas?

Note: I'm running on MacOSX

kameruchi’s picture

same problem here, on OS X too :(

kameruchi’s picture

The Database user`settings was "Host: Any", I changed it to "localhost" and it worked. Dont know why, "local" supposed to be included in "Any"~

prakasharavind’s picture

Hai Friends,

As you people mentioned above I got the same error but I got the host name and entered it. But again the same page is coming and asking me to enter database name, username etc... but doesnot showing any erros. Again if I try also it coming to the same page asking for database details but never showing errors. Please help me.

MrBond’s picture

I keep getting the same error - either the page refreshes back to blank textboxes, or it questions my username etc.

I've sent a message to my hosts asking if they can help, and they sent me this reply:

'We've taken a look at the code and its fairly complex and would take considerable time to work out its operation.

As another suggestion, you may wish to look into which files and folders require write permissions. This may have some bearing on why the page appears not to move on to the next stage.'

Do you think permissions may be the problem?

swartik’s picture

I was having the same error. I solved it by changing the permissions on settings.php to make it writeable by everyone.

vm’s picture

After installation insure you set settings.php to a more secure setting otherwise your site is insecure. Anyone would be able to read your settings.php file and as such would have ALL of your DB information.

swartik’s picture

I can't do that. Our Apache server runs as a different user than the owner (me) of settings.php. At best I can make it non-writeable.

vm’s picture

?¿? you claimed it was set CHMODD'd to 777

what is it CHMOD'd to now ?

MrBond’s picture

Thanks for the advice, I'll give it a try :-)

encgraphics’s picture

I'm getting the same problem. My client uses Yahoo to manage their domain and I installed mysqlphp using the Yahoo Control Panel. I'm not used to Yahoo, I'm used to Cpanel. When I try to setup the database I get this message:

Failure to connect to your MySQL database server. MySQL reports the following message: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (46).
Are you sure you have the correct username and password?
Are you sure that you have typed the correct database hostname?
Are you sure that the database server is running?

I typed in the correct username, password, database name and still get this error. mysql is located at www.kidskornermag.com/phpmysql. I wasn't sure if this was the problem.

Here is what the top of my phpmysql area says: MySQL 4.1.14 running on kidskornermag.com as kids@localhost

________________________
Erica N Carrasco
Graphic Designer
www.encGraphics.com

vm’s picture

kids@localhost

have you tried localhost for db hostname?

avyaktha’s picture

Failure to connect to your MySQL database server. MySQL reports the following message: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (46).

* Are you sure you have the correct username and password?
* Are you sure that you have typed the correct database hostname?
* Are you sure that the database server is running?

http://www.akarmaworks.com/drupal/install.php?profile=default

I have an account with yahoo webhosting , I am able to login into the DB using the phpAdmin but drupal complains
i tried changing the hostname but didnt work. I manually edited the settings.php to put in the correct url that didnt work too.
I have all the privileges for this user in the db
Can some one please suggest what iam doing wrong?

KalElVZ’s picture

I was told by my host to change the advanced option hostname to: "localhost.localdomain" and that should work. That's what I ended up having to do when I was testing out Expression Engine as well, and it worked fine.

Not so with Drupal, because it seems to not pass the 'localhost.localdomain' information to the settings.php file (or wherever it's to be used). The error still comes up as ' Unable to lock a test table on user'@'localhost' to database 'mysite_com_-_drupal", which from my (and the tech support's) understanding, means that it's still looking for 'myusername@localhost', not 'myusername@localhost.localdomain'.

Any thoughts? I wouldn't even mind going in manually and changing the settings as need be-- I just need to know where to change it.

pinchg’s picture

For yahoo hosting at least, just put "mysql" as your db host

Jock IT’s picture

@ bobbyswim

I am using cpanel and it is my first time using it and i cant seem to install it.

I had installed it before but i tried to mess with the settings and had to wipe it and reinstall it and now i can install the system.

can anyone help me?

Jock IT’s picture

never mind i sorted it.

thank you for anyone who has read my response, i am sorry for wasting your time