02-16-2011, 11:09 AM | #1 |
Administrator
Join Date: Jul 2010
Posts: 402
Rep Power: 10 |
Add Prefix To Existing Vbulletin Tables
If you never used prefixes for your MySQL tables on your vbulletin install and now you want to, here is a little script that will rename all the tables with the desired prefix. You must ONLY RUN THIS SCRIPT ONCE! Upload it to your forum root. After you run it, DELETE IT.
The only thing you can define is the prefix. Code:
<?php $prefix = 'vb_'; require_once('./global.php'); $rows = $vbulletin->db->query("SHOW TABLES"); while ($row = $vbulletin->db->fetch_array($rows)) { $table_name = $row['Tables_in_rib']; $vbulletin->db->query("ALTER TABLE $table_name RENAME TO $prefix$table_name "); } echo "Completed, delete this file immediately!"; ?> |
Reply With Quote |
02-21-2011, 02:46 AM | #2 |
Junior Member
Join Date: Jan 2011
Posts: 23
Rep Power: 0 |
Thank you for this. I have a site that needs this done.
__________________
. Thanks. Tip: You can also find me at digitalFAQ.com/forum, if I don't reply here. |
Reply With Quote |
08-03-2011, 01:24 PM | #3 |
Junior Member
Join Date: Aug 2011
Posts: 4
Rep Power: 0 |
What is the advantage of having prefixes?
|
Reply With Quote |
08-03-2011, 03:13 PM | #4 |
Administrator
Join Date: Jul 2010
Posts: 402
Rep Power: 10 |
There is no real advantage. Sometimes people are only allowed 1 mysql database.. Using prefixes avoid collisions with other scripts who may have named their tables the same, or also allows multiple forum installs in one database.
|
Reply With Quote |
08-03-2011, 04:24 PM | #5 |
Junior Member
Join Date: Aug 2011
Posts: 4
Rep Power: 0 |
|
Reply With Quote |
08-30-2011, 02:01 AM | #6 |
Junior Member
Join Date: Jan 2011
Posts: 23
Rep Power: 0 |
Security by obscurity, too.
Harder for an attacker to go after a table if he/she doesn't know the name of it.
__________________
. Thanks. Tip: You can also find me at digitalFAQ.com/forum, if I don't reply here. |
Reply With Quote |
11-13-2012, 03:47 AM | #7 |
Junior Member
Join Date: Jul 2012
Posts: 2
Rep Power: 0 |
Got this error:
Code:
Database error in vBulletin 4.2.0: Invalid SQL: ALTER TABLE RENAME TO wf_; MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RENAME TO wf_' at line 1 Error Number : 1064 Request Date : Tuesday, November 13th 2012 @ 02:46:04 AM Error Date : Tuesday, November 13th 2012 @ 02:46:04 AM Script : http://www.wiifriends.com/tool.php Referrer : IP Address : 68.53.229.176 Username : Brent W Classname : vB_Database_MySQLi MySQL Version : 5.5.28 |
Reply With Quote |
11-13-2012, 04:02 AM | #8 |
Junior Member
Join Date: Jul 2012
Posts: 2
Rep Power: 0 |
Just an FYI: http://www.yoursitename.com/install/tableprefix.php will rename them.
|
Reply With Quote |
Reply |
Tags |
vbulletin code
,
|
|
|