Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've a working version of wordpress in localhost and i tried to move them to the remote server.

As i've another wordpress installed in the same server and tried to rename the current tables to the prefix wp1_

I exported my local data to a sql file. After that i searched and renamed every table name with wp_ and changed them into wp1_ and imported to my server.

After that i tried to login in admin panel , it throws the following error

" You do not have sufficient permissions to access this page. "

I searched some forums and tried to change the values of meta key in the wp1_options and wp1_usermeta which was started with wp_

Still after this , i couldn't login.

And ideas on this?

Note: I've changed the wp-config and related details and the front end is working fine.

share|improve this question

5 Answers 5

This usually happens when the table prefix is manually changed but some changes have been overlooked.

Go to your user_meta table and have a look at the meta_key column. Check if fields like wp_capabilities have been changed to use the wp1_ prefix. Also look in your wp1_options table to check that user_roles has been changed to wp1_user_roles.

When the table prefix is manually changed, the prefixes on these fields in user_meta are often left unchanged:

capabilities

user_level

user_settings

user_settings_time

Check them all. You can quickly identify which ones haven't been changed by running this SQL query:

SELECT * FROM `wp1_usermeta` WHERE `meta_key` LIKE '%wp_%'
share|improve this answer

Codex under Altering Table Prefixes lists following necessary query to run to fix users after changing database prefix:

UPDATE 'newprefix_usermeta' SET 'meta_key' = REPLACE( 'meta_key' , 'oldprefix_', 'newprefix_' );
share|improve this answer

Here are the required steps:

  1. In wp-config.php, change $table_prefix = ‘wp_’; to your new prefix. E.g. $table_prefix = ‘mynewprefix_’;.

  2. In your database file, either via text editor or phpmyadmin (the latter if you have already performed the import), change every table prefix... it sounds like you already did this before the import (which is good, because I don't know the MySQL command to change table names once they are imported, except maybe via MySQL Workbench).

  3. The following database entries need to have the prefix changed (organized by table):

(Previously) wp_options

wp_user_roles => mynewprefix_user_roles

(Previously) wp_usermeta

wp_capabilities => mynewprefix_capabilities [recurring based on no. of users]

wp_user_level  => mynewprefix_user_level [recurring based on no. of users]

wp_usersettings => mynewprefix_usersettings

wp_usersettingstime => mynewprefix_usersettingstime

wp_autosave_draft_ids => mynewprefix_autosave_draft_ids

wp_metaboxorder_dashboard => mynewprefix_metaboxorder_dashboard

N.B. Some plugins and themes may add additional entries/tables that also need to be changed, but you can run the query mentioned by Elpie on the entire database to check this.

share|improve this answer

Instead of renaming the tables, just create a new database and change your wp-config.php. It's a much easier solution, as long as you can create more databases.

share|improve this answer
    
I've set up users, post, pages etc., That's why i choose to import and not create new tables. There are lots of data and i could not replicate it again and i don't have access to create a database (its a demo server). –  Vijay May 30 '11 at 10:02

Try to chmod all your wordpress-related files to 755 and then see if it works.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.