Change Joomla Table Prefix

We are interested in your security and performance! To improve performance and enhance security of the Joomla platform be sure to provide a new prefix for Joomla database tables. This can not only provide improvements as indicated about security and performance, but it can provide a unique instance of the tables so more tables and Joomla installations can be performed. This may not be the case in your situation, like for single company installation, however it can provide a self-documenting installation. That’s to say that when you see the tables for a company “Joe’s Hardware Shop” in your database you can easily recognize the owning tables by the prefix. It’s more recognizable as to which business the database belongs to.

Just in case you installed Joomla with the default “jos_” table prefix, here are the instructions to change the prefix to something else to improve security. Notice:  follow the instructions as they’re listed and it will minimize downtime since youre website is running. Here at SnapJag Creative Designs we want our instructions are such that you can feel assured that you are able to perform the steps with accuracy, efficiency, and with as little impact as possible to your operations.

It is highly recommended that you perform these steps at a low-peak time. But make sure you are awake enough to follow the instructions if you’re doing it at night. =) Note: This method does not ask you to remove the tables first, so don’t delete the old “jos_” tables until the end. This is to help make sure you have a backup in place and that the old structure is still ready in case anything goes wrong.

  1. Kick people out: make sure no one is doing administration or management in the Joomla back-end.
  2. Login to phpMyAdmin.
  3. Click on the Export link, leaving all options as they are; specifically for:
    1. Export: SQL
    2. SQL options: SQL Export compatibility = None
    3. SQL options: Structure (Add AUTO_INCREMENT, Enclose table and field names with backquotes)
    4. SQL options: Data (Complete inserts, Extended inserts, Max Length: 50000, Use hexadecimal for binary fields, Export type: INSERT)
    5. Save to file: not on, you will use the query box to copy and paste the values to disk. If you have large content then use the method to capture to the server and retrieve the data.
  4. Click the Go link, this export may take a few minutes depending on the size of your content.
  5. Open your favorite editor (like UltraEdit), copy the content from the query box and paste it to a new text window in the text editor.
  6. Save the file as a new name to make a backup of the old data.
  7. Save the file again as a new name to make a copy of the new data.
  8. Do a search and replace for “jos_” and replace with the four character prefix of your choice. If you are using UltraEdit, choose to see a line listing of all results and scan them to make sure replacements didn’t happen with any other data than that of table name references.
  9. Comment out with dashes (‘–‘) the statement ‘Create Database…’ if it exists in the script so that an attempt to create the database doesn’t occur. This will cause an error, no damage, just an error and you’ll have to do this step and run it again if you don’t.
  10. Click on the SQL Query Window link to bring up a new SQL query window. You can’t do this next step in the same window as the query box output.
  11. Copy the text from the text editor and paste them into the SQL Query Window where it says “Run SQL query/queries on server localhost:”
  12. Click the Go button to begin the script to create the new tables.
  13. Wait for the response from the server in the browser window behind the SQL Query Window. Address any issues if you need to.
  14. If the response is not an error. Close the SQL Query Window show the phpMyAdmin home window.
  15. It’s possible the left side of the browser will say “No Tables Found”. Don’t worry, press F5 to refresh the window, and you’ll see all the new tables.
  16. Open your Joomla! back-end, go to Site | Global Configuration | Server
  17. Change the Database Settings | Database Prefix to your new prefix and click Save
  18. You may now be required to sign-in again. You will now be connected to your new tables.
  19. One more step is to delete the old ‘jos_’ tables. Go back to the phpMyAdmin window
  20. Click the Databases link, then the database where the tables exist
  21. Select all the ‘jos_’ tables, be careful to not select any new tables.
  22. At the bottom of the list, click the combo box “With Selected” and click Drop. This will build a script to remove the selected tables, confirm they are only the ‘jos_’ tables, and click Go.
  23. Wait for a ‘Executed Successfully’ statement and then
  24. Close the myPHPAdmin window
  25. For one final test, back in Joomla! logout and log back in and create some articles or do normal things to test the functionality.
  26. Also, confirm in the Site | Global Configuration | Server screen that the Database Prefix is set accordingly.

Hope this has been thorough and helpful. If you see any problems, errors, or changes that need to be made, please let us know.

2 thoughts on “Change Joomla Table Prefix

Leave a Reply