MyBB Community Forums

Full Version: Changing the database table prefix'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

I would like to change all the default database table prefix' for security purposes and was wondering if there was a easy way to do this without effecting or causing any errors with my forums.

Also, if any of you know any great ways to protect and secure MyBB please tell me, I have used google but I want to see if I can get more tips here since I want my stuff to be secure af.

assuming that you are using phpMyAdmin, see replies here (esp. last two)

see Protecting Your MyBB Forum | Security Tutorials List
Cheers m

Will this effect the forums in anyway?
changing database tables prefix needs changing of the prefix configuration in ~/inc/config.php file
$config['database']['table_prefix'] = 'mybb_';
mybb_ needs to be changed to your new prefix
If you are using phpmyadmin, you can select all of your tables (at the bottom), click the dropdown and select "Replace table prefix". In the from box, type in mybb, in the to box, type in your new prefix.

You can also do it with an sql query.
SET @database   = "mybb";
SET @old_prefix = "mybb";
SET @new_prefix = "mybb123232";
SELECT concat("RENAME TABLE ",TABLE_NAME," TO ",replace(TABLE_NAME, @old_prefix, @new_prefix),';') AS "SQL"
FROM information_schema.TABLES WHERE TABLE_SCHEMA = @database;
You are going to have to have Full Texts on instead of Partial Texts (Under Options above the output then rerun the query). Copy the output and run that and it will rename all tables.

You will also have to change your prefix in inc/config.php
Cheers Boonie