Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By pz29 on
Hi, everyone:
what does the "unable to to select database" error mean? Where did I go wrong during installation? The database shows up on the phpmyadmin page.
Thank you.
pz
Comments
settings.php
Typically it means to check your sites/default/settings.php file.
Or if you are using sites/www.example.org/settings.php file to make sure you have the name of the folder right.
got it
I got it figured out--thank you.
pz
Great
When you figure something out, PLEASE share it.
I'm glad you figured it out but I am still getting the stupid no help message.
"Unable to Select Database" error
I have searched and RTFM.
If I change anything in the name of the database to make it wrong in settings.php on the
$db_url = 'mysql://me:337nA@mysite.com/dru1';
line I still get the "Unable to Select Database" error.
If I make anything in either user or password wrong I get a
Warning: mysql_connect(): Access denied for user:
error.
If I make anything in the Localhost name wrong I get
Warning: mysql_connect(): Unknown MySQL Server Host.
This tells me that I have settings.php right and the database is there and it has database.mysql loaded.
Where do I go from here?
This is a clean new install of ver 4.6.3.
Same here!
I Get:
"Fatal error: Call to undefined function: mysql_real_escape_string() in /var/www/html/cm2/includes/database.mysql.inc on line 239"
Then if I make password wrong I get:
"Warning: Access denied for user: 'user@localhost' (Using password: YES) in /var/www/html/cm2/includes/database.mysql.inc on line 31
Warning: MySQL Connection Failed: Access denied for user: 'user@localhost' (Using password: YES) in /var/www/html/cm2/includes/database.mysql.inc on line 31
Access denied for user: 'user@localhost' (Using password: YES)"
I also have similar problems on lower version debian package, I have tried this on RH9, Ubuntu badger and breezy, this is driving me crazy, I know the user has proper privs to database tec..
I also know I am not the only one with this problem, followed install.txt every time.
What PHP version
What php version are you using?
PS It's not the same
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.
Not same
Heine,
Appreciate your quick reply, I am using 4.2.2-17. Sorry if posted in wrong thread.
Thanks!
Version problem
I'm afraid I have to tell you that you need to upgrade PHP if you want to use Drupal. Drupal requires PHP 4.3.3 or higher.
Doesn't matter that you posted in this thread, but try to be careful not to preempt a full diagnosis :-).
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.
Ok Thanks!
Thanks, and yes, I am guilty of preempting a full diagnoses, my apologies. and thankyou for being part of open source
I didn't got any message
I didn't got any message about the error.
and the mysql_connect_db() return false.
and I am sure that I have all the privlege and the database exist.
does PHP4 support the function statement:mysql_connect_db() ?
I didn't get any message
Drupal requires PHP 4.3.3 or higher.
Possible Solution
I had the same problem as you. When I added a user to the database in Cpanel I added it under the heading "Users" where you can add a user and password and got the error "Unable to select database" when I pointed my browser to the site
What I omitted to do was to click on "Add user to database" above this. Once I've done that the problem was solved.
Hope this helps
This solution helped me
It would be interesting to know if this message was generated by drupal or mysql. If it's drupal - then a suggestion of "you may need to add the user to database" could be helpful...
Hi i am having same problem
Hi i am having same problem which u were having... plz tell me how did you add the address of database in settings.php...
i have the database named drupal in "var/lib/mysql/drupal" folder what command should i enter in settings.php file ...
tell me plz...
ALSO !!!
I was getting the error - "Unable to connect to database" and cannot log into with user blah blah - well, I FORGOT TO CREATE the mysql database content.
I simply went into phpmyadmin and imported the database / database.mysql
And now it works.
I'm a bonehead sometimes.
-G
It happened to me
It happened to me but I didn't forgot to load the database.mysql. it means the table was created.
But the problem remain.
Does anybody knows any other solution to the problem ?
TheFikr
Happened to me, too
I just installed on my gentoo box and had the same "Unabled to select database failure". After reading a few posts here and checking my files, I found that I had entered the db_url and base_url correctly. I connected to mysql and all is good(>mysql -u drupal -p).
When I 'ls' my drupal/sites directory, I see that I have two directories now. The default directory where I have been modifying the settings.php file like crazy and another direcotry named after the base_url I had entered the first time(mlongmire.net) in defaults. It finally dawned on me to check the settings in that directory and what I found was that the database name was set incorrectly. Mine was named 'mldrupal' instead of 'drupal'. I corrected the db_url value in settings.php in sites/mlongmire.net and everything started working great.
This is not a serious drupal installation, just messing around with it.
HTH
Mark Longmire
http://mlongmire.net/drupal
gentoo linux 2.6.14
mySql 4.1.14
php 5.1.2
drupal 4.6.5
another solution
I had the same trouble... always double check your settings.php and make sure your database name and username are entered CORRECTLY (as in they're not the same). it's a dumb mistake but it's happened to me.
Ha, well, I got the exact
Ha, well, I got the exact same error. do you know it was a simple typo in the db name? Spent hours searching for the solution...ditto on the dumb mistake. :-P
Same problems two site
Hi, i had the same problem after settings the second site managed by same installation of drupal.
I solved giving the access to two different database (one for each site) to two different users.
maybe this can help.....
cheers
roberto bosio
http://bosiorob.homelinux.org/
changed 'mycomputer.mydomain.com' to 'localhost' in settings.php
i had this same problem with a backup install on the same machine as the 'real' drupal install. database user names were the same, all that differed was the database name in the settings.php file.
i changed the 'host name' from the name of the machine to 'localhost' and it solved the problem. so the line in settings.php reads:
$db_url = 'mysql://drupal-user:password@localhost/drupalbackup';
/jt