tags:

views:

83

answers:

3

I had to migrate a drupal site from a Windows machine running the xampp package to a machine running Linux (Ubuntu 10.04).

I exported the database to a sql file on the source machine and recreated the database using the file on the destination machine. Also, i copied my website folder from the source to the destination. I also made the hostname,username and password changes in settings.php to reflect the mysql credentials on the destination machine,but when i try to access the site, i get the message 'Error connecting to mysql'.

What could be going wrong here ?

A: 

SSH to your web server and do

mysql -u username -h hostname -p

Can you connect using that? If that doesn't work, then it's something with your database server configuration. If that works, then it's something with your Drupal configuration.

What about

mysql -u username -h hostname -p databasename

If that works, try SHOW TABLES; to see if there's anything in there.

Matti Virkkunen
Yes,mysql -u username -h hostname -p works,so the username, password and hostname are correct.Im unable to figure out what could be the problem with the Drupal config, because i have copied the site as is. It is working on the Windows machine,and i havent made any changes apart from settings.php on the destination Linux machine ! :(
Tim
A: 

are you sure you go the right syntax $db_url = 'mysqli://root:pass1@localhost/drupaldb'

and you have no prefix config.. i have moved many db and they all worked

.. are you sure you are using a standard port and there are no firewall issues

username:password@host:port/databasename

Drew
Thanks for the reply...what is prefix config ?
Tim
in the settings.php just bellow the db setting
Drew
+1  A: 

I would start over and install Drupal from scratch. You can leave all of your files alone, but get rid of sites/default/settings.php. Then run the /install.php script so that you know you're getting a proper DB connection. After you get back to square 1, then try bringing in your old DB. It's a PITA, but migrating Drupal sites tends to be.

The Backup and Migrate module can be really helpful in situations like yours. Try installing it on your dev site, run the backup, and then reinstall your staging site from scratch, install backup_migrate and then restore from there.

JGrubb