What is a table prefix?

alioygur picture alioygur · Dec 22, 2010 · Viewed 87.3k times · Source

What is a table prefix, and what are their advantages and disadvantages? This is in relation to MySQL.

Answer

user284291 picture user284291 · Dec 22, 2010

This is often used to distinguish different installations of the same script from each other. For example let´s say you have two Joomla Installations with different content on your server, but only one MySQL Database.

Now, for obvious reasons both Joomla installations can´t share the same database tables, as that would result in both installations displaying the same contents. And that is where the prefix kicks in.

By using different table prefixes you can let Joomla Installation #1 know that it is supposed to use all the table with Prefix JOS_ and Joomla Installation #2 has to use all the tables with the prefix JOS2_