Moving Drupal -- database connection problem

I recently moved a live Drupal install to my Linode from another host. I had already copied the tables to my Linode's mysql server, and had adjusted the Drupal settings.php to point to my Linode. It worked fine connecting to my Linode's mysql from the other host, but after transferring the files and adjusting the DNS to point to my Linode, it starting outputting the following error:

    Warning: PDO::__construct(): [2002] Connection refused (trying to connect via tcp://database.youdolinux.com:3306) in DatabaseConnection->__construct() (line 304 of /srv/www/arklinux.org/html/includes/database/database.inc).
    Warning: PDO::__construct(): [2002] Connection refused (trying to connect via tcp://database.youdolinux.com:3306) in DatabaseConnection->__construct() (line 304 of /srv/www/arklinux.org/html/includes/database/database.inc).
    Warning: PDO::__construct(): [2002] Connection refused (trying to connect via tcp://database.youdolinux.com:3306) in DatabaseConnection->__construct() (line 304 of /srv/www/arklinux.org/html/includes/database/database.inc).
    Warning: PDO::__construct(): [2002] Connection refused (trying to connect via tcp://database.youdolinux.com:3306) in DatabaseConnection->__construct() (line 304 of /srv/www/arklinux.org/html/includes/database/database.inc).
    PDOException: SQLSTATE[HY000] [2002] Connection refused in lock_may_be_available() (line 164 of /srv/www/arklinux.org/html/includes/lock.inc).

The strange problem here is that settings.php is no longer pointing to database.youdolinux.com, I already changed it to localhost. I tried changing it back with no joy.

I currently have a temporary makeshift web page showing up for the site, but the Drupal version is so much better.

EDIT: I have already double checked that settings.php has the correct database, mysql user, and mysql password.

1 Reply

It seems that there are two sections of settings.php for database configuration. One section is a single line giving the database info, and the other section is the same database info, except on separate lines. The one that was on separate lines had the wrong info. Fixing it fixed the problem.

I never saw that multi-line section before, and never had to modify it in the past…

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct