Hello. I Like drupal. Install it long ago and today I logged in to the database and changed the password. But i don't know how to change it for drupal. If you can, please heLp me :)

Unable to connect to database server

If you still have to install Drupal, proceed to the installation page.

If you have already finished installed Drupal, this either means that the username and password information in your settings.php file is incorrect or that we can't connect to the MySQL database server. This could mean your hosting provider's database server is down.


SteveK’s picture

The settings.php file is located in the sites/default/ folder... so sites/default/settings.php should be the path. if you scroll down a bit (line 87 on my install) you should see something like this:

$db_url = 'mysql://root:root@localhost/drupal47';

This is a breakdown of the structure of that path:

$db_url = 'mysql://username:password@localhost/databasename';

I work here: Raincity Studios.com
I hang out here: Steve Krueger.com

gowcoizer’s picture

I have no settings.php file
I renamed .htacces file is this a problem ?

Theese are all the files I have in that directory.

.htaccess.old 3.61 KB
CHANGELOG.txt 28.83 KB

INSTALL.mysql.txt 1.4 KB

INSTALL.pgsql.txt 1.05 KB

INSTALL.txt 9.05 KB

LICENSE.txt 17.64 KB


UPGRADE.txt 2.87 KB

cron.php 262 B

index.php 872 B

robots.txt 1.64 KB

update.php 29.79 KB


ray_223’s picture

2 points:

* Why did you rename the .htaccess file? Unless there is a good reason rename it back,
* re-read "SteveK"'s comment about the location of the "settings.php" file. (You listed the contents of Drupal root directory)

Ray Smith

gowcoizer’s picture

I renamed the htaccess file because i can't open the site if it's with the original name. I don't understand that much but I will. What is the purpose of htaccess file ?

and Thank you so much Stevek and Ray. The settings file is there. My bad in finding it.

VM’s picture

the purpose of the .htaccess file to control url rewrites among other things. Not sure that running Drupal without it is logical.

The question is one for your host. Why can't you use a .htaccess file. My guess is your host may be disallowing it.

Though without further information from you it's hard to diagnose in total.

information that would be of benefit:
Type of environment: ie: shared hosting ? unix ? IIS ? version of Apache ?

My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

jscoble’s picture

If you do not know what a file or a configuration setting is for, it is a good idea to find out what the purpose of a file is before renaming it unless you want to deal with unintended and unknown consequences. In this case, doing a search on htaccess would help your understanding. Search in Drupal to find out about how it relates to Drupal and search at your favorite search engine to find out more about htaccess in general.

Breaking something isn't the worst that can happen, you could end up creating security holes allowing crackers and other miscreants to get into your site.

gowcoizer’s picture

I changed $db_url = 'mysql://username:password@localhost/databasename';

on the password i set my new database password and that's what i resulted :D

Warning: parse_url(mysql://respectrap_db1:password.awardspace.com/respectrap_db1): Unable to parse url in /home/www/resrecords.awardspace.com/gow/includes/database.mysql.inc on line 56

Warning: Cannot modify header information - headers already sent by (output started at /home/www/resrecords.awardspace.com/gow/includes/database.mysql.inc:56) in /home/www/resrecords.awardspace.com/gow/includes/common.inc on line 141

Warning: Cannot modify header information - headers already sent by (output started at /home/www/resrecords.awardspace.com/gow/includes/database.mysql.inc:56) in /home/www/resrecords.awardspace.com/gow/includes/common.inc on line 141

If i change the url's in these filese will everything be OuKei ? I am sorry for my newity.

gowcoizer’s picture

Now I saw what you wrote. I will read more about htaccess file. I'm in www.awardspace.com so may be they disallow htaccess file. I will go read some and try to find the easiest way to make as it was. Thanks so much for the attention you spent on me.

gowcoizer’s picture

So I'm afraid to mix anymore. May I ask if a Install drupal once again with the current database name password etc. I think it should be as the last time when it worked. With no connection errors. Can I really do this ? :S

jscoble’s picture

$db_url = 'mysql://username:password@localhost/databasename';


should be:


unless the installation you are connecting to is not on the same server as Drupal. In that case replace localhost with the hostname that mysql resides on and don't replace the @ with a .

And since you posted the username, database and host you are using, I would recommend changing the database user name for security purposes and next time post the username as username, similar to what you did with password.

gowcoizer’s picture

Affirmative & really thanks amigo. Can you tell something about the procedure i suggest to reinstall drupall.
I mean i know how to install it but on the same database will it be proper ?

jscoble’s picture

Why do you want to reinstall drupal?

The procedure you describe would result in a lot of SQL errors on the install script, if it works at all. I have never tried it so I wouldn't know. In that situation I would recommend installing Drupal in a new database and working from there. This would result in a fresh install of Drupal, which may not be what you desire.

gowcoizer’s picture

I tried a lot of things.


it keeps saying

Fatal error: Call to undefined function: db_connect() in /home/www/mysubdomain.awardspace.com/folderofthesite/includes/database.inc on line 128

I edited in the settings.php file my first database password which was with no problems.
After that I changed the database password with the same. And It's that again ?
What am I missing.

jscoble’s picture

Is mysql on the same server as your Drupal installation? If so use localhost and not IPadressofthehost. If the database is another server, make sure you granted that login ID permission to login from the host you are connecting from.

I am assuming that you are running MySQL.

gowcoizer’s picture

MySQL 4.1.18 is the version. "ID" is fine. I'll try again all the metods to make sure the mistake isn't at me and tell you the results.

gowcoizer’s picture

The error is
Fatal error: Call to undefined function: db_connect() in /home/www/mysitename.awardspace.com/includes/database.inc on line 128

What Should I cnange in thet database.inc on line 128

it says

$db_conns[$name] = db_connect($connect_url)

VM’s picture

you change nothing in a core file.

what we need to know is exactly what you are putting in your $db_url string. are use using localhost ? what does the top of your DB tool (phpmyadmin) say your mysql server address is ?

The issues you are facing are either:

A) incorrect login information
B) a server that is incorrectly configured to allow you to connect.

A question though, why are you not using Drupal 5.x ? which is easier to install, Verison 4.7.x is about to be sunset when 6.0 is released in full. I don't see why one would decide to remain this far behind.

What I"d do at this point.

Drop all tables in the DB and make sure it is empty
remove all 4.7 files
upload Drupal 5.x and start a new.

after watching this videocast = http://drupal.org/videocasts/installing-5

My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )

gowcoizer’s picture

VeryMisunderstood I will follow your advice. When I upload 5.x and above it says register_globals enabled. Incopatible enviroment.

In awardspace I can't change the php settings. In future may be I will have problems if I stay with that old version of drupal so I will find hopefull host and use the new versions. Thank you everybody so much Drupal will continue developing I hope. For know I can say just thank you. After I will donate for your work. See ya.