Migrating drupal site from a Windows to a Linux machine
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 w开发者_开发知识库rong here ?
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.
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.
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
精彩评论