You are here: Computer Video TutorialWordpress TutorialHow To Change WordPress Database Table Prefix
Due to regular updates on WP, if you look for Twenty Eleven theme modification or customization tutorial, first of all, first check this post. Thanks.

How To Change WordPress Database Table Prefix

by Kimi on May 3, 2010

Why do we want to change this wordpress database table name prefix?

It’s because when you installed WordPress by default, all of your database tables start with wp_.

Hackers know it, so they can potentially do SQL injection, putting junk scripts into your database automatically.

If you are a blogger who wants to secure your database, you are going to change wp table prefix.

So for example, replacing wp_ to lolol_.  I know it is a silly prefix but i want to point out that you can only use letters and numbers, but not special characters such as period, coma, etc.

//Do Back up your database first, as it’s a little bit complicated (see my post about backup wordpress database in 2 minutes). The best way is you try it in your local wordpress installation. If you still don’t have it, you can check this post for mac user and this post for windows user.

It’s really a good idea to change the database prefix while you are installing wordpress, so you will have no hassle to change it later on. But if you already have it installed, we can do it manually.

There is also a plugin called wp prefix changer,  i have tried it but it didn’t work, so i do change it manually. For some of you who had experience with this plugin and it works, feel free to leave a comment :)

blog seo

Subscribe new tips via Email:

Was the post helpful? Share it to help others with:

{ 22 comments… read them below or add one }

Tony May 17, 2010 at 2:47 pm

Hey there great article.. How long would it take to change the tables on a site that has about 400 articles..

Can you email me please with the answer, thanks for your time

Reply

Dina May 17, 2010 at 4:26 pm

Hey Tony, sure i can email you.

Reply

Tony May 17, 2010 at 6:16 pm

hey its ok.. i did it.. thanks anyway

Reply

Dina May 18, 2010 at 6:51 am

Awesome Tony! you are very welcome

Reply

Jack June 2, 2010 at 1:19 am

The video worked perfectly, thank you !

Reply

Dina June 2, 2010 at 1:28 am

Hello Jack,

You’re very welcome! So glad it works out, Matilda is sooooo pretty :D Good luck with new life. If you want to have a picture in your avatar, this video might help you too.

Have fun when family from Aussie comes :) :)

Reply

Jack June 2, 2010 at 1:50 am

Ah an avatar, that sounds like a great idea. I’ll give it a go tomorrow. Thank you for the kind words!

And yes we look forward to their arrival ;)

Reply

Dina June 2, 2010 at 10:16 am

Yes, if you are into blogging community, and want to comment alot in any blogs, it would be much better showing your logo image or any images than default avatar :D I agree with you, take the time and you will be fine. Greetings!

Reply

Aspen September 6, 2010 at 5:04 am

Thank you soo much. You are an excellent trainer :-)

Gratitude
Aspen

Reply

Ben September 13, 2010 at 6:34 pm

Hi, thank you so much for this, it saved me so much time and rescued me from hours of trawling the internet for this information. I have bookmarked your site and will be checking back regularly!

Reply

Dina September 13, 2010 at 6:56 pm

Hello Ben, you’re very welcome.

I am glad the post was useful. Cheers.

Reply

Kev Jaffray February 19, 2011 at 12:45 pm

Hi Kimi, I found your video to be a great help in fixing a prefix error in a wordpress database I was having trouble with. Thank you for taking the time to make it and share. Best wishes, Kev

Reply

Kimi February 22, 2011 at 7:26 am

Hi Kev!

I am so glad the video could help you, and the most part, you fixed your database prefix error, the database itself is very crucial to our blogs.

Thanks so much for leaving your nice comment,

Have a great week, Kev!

Kimi.

Reply

Keith Davis February 20, 2011 at 3:59 pm

Hi Kimi
Great video.
Never had the confidence to change my database prefix but this video may give me that confidence.

Thanks for a super vid.

Reply

Kimi February 22, 2011 at 7:31 am

Keith!

Did you manage to change all the database prefix? Honestly, I am still afraid if I had to change my database prefix, but I suggest everyone to backup database first, just incase..

I hope your database has any prefix you want by now.

Thanks, Keith!

Kimi.

Reply

Andreas May 9, 2011 at 7:11 pm

Excellent tutorial! Thanks a lot for making this available. The only one thing that remains to be mentioned is that you may only use letters, numbers and underscore. I had to do it all over again, because I used a prefix that contained a special character. ;)

Also, it’s definitely not a bad idea to put your site into maintenance mode before to work on the database.

Man, I am really happy it worked so smoothly.

Thanks a lot!
Andreas

Reply

Paul June 5, 2011 at 11:53 am

Thanks, Kimi. Worked perfectly.

One suggestion. You could just copy the tables to the same db but with the new names using phpmyadmin. Then, no need to backup!

Just a thought.

Paul

Reply

Gowtham June 11, 2011 at 5:47 am

Thanks for the tutorial. But will there be any issues, if i download the complete database and open it will a text editor and find and replace all the “wp_” to a new prefix and upload the file again?

Reply

Kimi June 11, 2011 at 8:05 pm

Yes, there will always be issues if you do it incorrectly Gowtham.

I suggest you to copy your site with the exact database in your PC or Mac, see this post: http://www.blog.web6.org/copy-live-wordpress-blog-to-computer/

That post I use to copy this blog in my localhost, and then you can try to change your database one by one, and see how it works, if you change all correctly, your blog in localhost will be fine, if not, then something is done incorrect. But at least, your “online” blog will still work, only site in localhost breaks.

I hope this work.

Reply

Gowtham June 12, 2011 at 6:28 am

I greatly appreciate your detailed reply. I took a backup of my database and all the files and set it up on my localhost using WAMP, then what i did was i took sql database and replaced all the “wp_” with a new prefix and uploaded in my localhost Database. And it worked. The only thing, was that there was a error showing up in the widget area, so then i placed new widgets and the error disappeared.

I did the same with the live server, and it worked. One thing is that if people want to do it this way, they need to make sure that, they shouldn’t upgrade wordpress in the process.

Reply

vinodh November 9, 2011 at 11:02 am

This helped me a lot. thanks

Reply

Elizabeth December 12, 2011 at 6:53 am

You’re totally fabulous for creating this video. Gosh I appreciate this so much. Works perfectly.

Reply

Know better? Feedbacks, or Questions? Shoot! :-)

Please use a name instead of blog name or SEO stuff, otherwise it will be deleted right away.

About checkbox → See more my post:how to get rid of spam bots in wordpress post.

Thank you for visiting, you're always welcomed to be here again!

Previous post:

Next post: