Change wordpress database in wp-config
I'm trying to replace the WordPress database I have on my live server. Here's the scenario: I have two databases on my server开发者_JAVA百科. The old one and the new one. When I edit config.php to change the database name from the old one to the new one, WordPress wants me to re-install. Here's why I'm confused...
- The tables in the new database have been updated to the old URL (I'm keeping the same URL).
- It's the same database user so the db user and db password don't need to change.
- The db user has permissions for the new database.
I thought that I should be able to change the database name and go, but WordPress isn't letting me. Any help would be greatly appreciated. I've been working on this for several hours and I'm at my wit's end. I know there just HAS to be a way that doesn't involve manually adding/editing content in the WordPress admin.
Have you made sure that the wp-config.php:
$table_prefix = '';
Is the same as the prefix in the database (phpMyAdmin) if you use that? Usually that can keep displaying the admin/install.php page.
Wordpress prompts you to reinstall Wordpress because you're missing a whole directory in your Wordpress files (forget which one, sorry). In part, it will create the wp-config file which will store the database info.
I can't see it be bad to follow the install process, it'll ask you for the credentials to your database, which should atleast overwrite the old file and configuration. Don't forget to backup your files before doing this, in case it all goes to hell.
I had the same issue. It turned out that my new MySQL DB had an issue.
I restored the DB with innobackupex and didn't apply the --apply-log
parameter on the backup directory to create the correct log files for the InnoDB engine.
Check your MySQL error log file to make sure that everything is normal. The log file's location is /var/log/mysql/[hostname].err
.
精彩评论