WordPress.org

Support

Support » Plugins and Hacks » Hacks » Different MySQL Prefix?

Different MySQL Prefix?

  • Is it even possible to use a different MySQL prefix for a plugin? Meaning, I want to use the same database along with the default wordpress tables, but create a table with a different prefix for my plugin operations.

    Is this possible? Thanks,
    Shane.

Viewing 2 replies - 1 through 2 (of 2 total)
  • It’s possible, but you need to hard-code the prefix in when you do your programming.

    I’d also advise against doing it that way. The DB prefix is set up to signify which DB tables belogn to which system if you’re uisng multiple sites/systems on a single DB. Even something like running WP and Drupal from the same DB would be the same thing. The prefix lets you know exactly which tables belong to your WP installation. This realyl helps when someone wants to delete/restore a DB for another system. They know they are safe to delete anything that doesn’t use their chosen prefix… which would include all of your tables… meaning they’d delete all of the data from your plugin. It’s not going to be a common use-case but the first rule of system design is that if a user can find a way to break something, they will.

    Thanks. I’ll stick to the WordPress prefix.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different MySQL Prefix?’ is closed to new replies.
Skip to toolbar