The Require a username prefix on names of new databases and database users setting controls whether cPanel automatically prepends a portion of the cPanel username to all new database and database user names. When enabled, this makes it easy to identify which account owns a given database, and helps prevent naming conflicts between accounts on a shared server.
Step 1: Log in to WHM
Log in to your WHM interface as the root user.
Step 2: Open Tweak Settings
Navigate to Home » Server Configuration » Tweak Settings.
Step 3: Locate the SQL setting
Click on the SQL tab at the top of the Tweak Settings page, or use the search box to find Require a username prefix on names of new databases and database users.
Step 4: Toggle the setting
- Set to On to require a username prefix on all new databases and database users (recommended for shared hosting).
- Set to Off to allow cPanel users to create databases and users without any prefix.
Step 5: Save your changes
Scroll to the bottom of the page and click Save. The change takes effect immediately for all new database creations.
How the Prefix Works
When enabled, the system behaves as follows:
- MySQL and PostgreSQL: The prefix uses the first eight characters of the system username followed by an underscore (e.g.,
username_databasename). - MariaDB: The prefix uses the entire system username followed by an underscore.
Important Notes
- This setting is global — it applies to all accounts on the server. You cannot selectively require prefixing for individual accounts.
- Changing this setting does not rename existing databases or database users. It only affects newly created ones.
- Enabling the prefix reduces the number of available characters for database and user names, since MySQL limits names to 64 characters total.
- If you rename a cPanel account, the database names and usernames that the account owns will not change automatically.
- If you need to create a database without a prefix temporarily, you can disable this setting, create the database, then re-enable it.
Troubleshooting
- Users report "database name too long": The username prefix plus the underscore uses characters from the 64-character MySQL limit. Consider enabling Force short prefix for MySQL and MariaDB databases to limit the prefix to eight characters, or advise users to use shorter names.
- Setting not visible: Ensure your server uses the Standard server profile, as some profiles may hide this option.