8

I remember the Prefix once was incented, because a lot of hosters only supported one Database per users, so many applications needed to share one database and it could come to conflicts. Also the prefix enabled you to install more then one magento into the same Database.

But, is there still a reason for them today I do not see? Even on a free hoster you get by far enough databases what I know.

6

First, there still may be some people who have a limited number of databases and can use this feature. And there may be people who find it handy to have it all in one database, although I would never recommend it. In my humble opinion, separating the databases is always better.

Second, it may also be a security concern. Having a prefix for your database tables makes it harder for an attacker to guess the names of the tables and do stupid stuff.

  • "Second...": make sure they cannot reach your database at all. Once they are in and are trying to guess table names, you already have a problem – 7ochem Oct 3 '16 at 10:03
  • @7ochem sure. But it is another barrier. At least I also lock my apartment door even though there is a locked frontdoor ;-) – Simon Oct 3 '16 at 10:35
7

As they say:

There are only two hard things in Computer Science: cache invalidation and naming things.

Regarding the latter, prefixes can be used to make naming things a little easier. If you don't find a need for it, don't use it. Is there a specific reason people might use it? Yes, so that they can name things logically.

As far as an example goes, imagine the poor soul who gets to manage hundreds of different active databases (production, staging, development, etc). Now imagine that he wants his job to be a little less difficult and he comes up with a naming scheme that helps him. Maybe he adds prod_, dev_, stage_ as prefixes to help recognize current status of the DB (with a migration script that renames tables when being moved).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.