Answer the question
In order to leave comments, you need to log in
Why are tables in databases of many sites given a prefix?
Greetings.
I didn’t attach any importance to this before, but now I’m interested. For example, we have two tables: users, addresses. In many CMS, and not only in them, for some reason it is possible / necessary to set a prefix to tables. And as a result, we get pref_users and pref_addresses. Explain why they do it.
Answer the question
In order to leave comments, you need to log in
Sometimes the same database is used for several sites. To prevent confusion, tables are prefixed.
If the site is hosted on shared hosting (aka virtual hosting), then only one database is often available at cheap rates. Or the second or third, etc. at extra charge. And sometimes you need to place several applications on the site, each with its own set of tables in the database. Then, in order to be able to shove them into one database, they came up with the idea of prefixing the tables. Thus, the CMS has its own, the forum has its own, the guest has its own, the photo gallery has its own, etc. And even if the names match, thanks to the prefixes, there are no conflicts, everything works.
But this, generally speaking, from hopelessness. It is better not to do this and still allocate its own database to each application.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question