Managing MySQL users
If you'd like to set up a separate MySQL user, do the following (you can also use these steps to modify any existing MySQL users):
The separate MySQL user will be able to access whatever database you choose, but the user will not be able to create any new databases.
- Sign in to Virtualmin (see Account logins and important URLs).
- Select a domain from the drop-down in the left-hand navigation (your main domain should be already selected when you first login to Virtualmin). This is the domain you'll be adding a MySQL user to.
- Click Edit Mail and FTP Users in the left-hand navigation. You should now see a list of current users for your selected domain.
- Click Add a user to this server.
- Each field name, such as Email address, is a clickable help link that will provide a brief description of each option in a popup window.
- In the Email address field enter a suitable username for your new user.
- The user's login name will be based on what you enter here plus the domain name. So, if the user's name is joe and the domain name is example.com, Joe's login would be joe-example. You'll need to use this full username when you use it to connect to a database.
- In the Real name field enter a suitable name for your user (e.g., MySQL User).
- The Password field will already be populated with password for your user. We recommend using the password that Virtualmin has created as they are fairly secure and you should also make a note of this password in case you need it later.
- Click Email settings and for Primary email address enabled? select No.
- Click Other user permissions And make sure FTP login enabled?, DAV login enabled?, and SubVersion login enabled? have been set to No
- For Allow access to databases, select the databases you want this user to have access to. To select more than one database, hold down the Control key in Windows or the Apple key in in OS X
- Finally, click Create to create your new user.
You've now created a user with MySQL access.
There is a hard coded limitation in MySQL that allows usernames to be up to 16 characters long only. If the resulting username were longer than 16 characters (e.g. because of a domain suffix being added by Virtualmin), it would be truncated to 16 characters. This may present a conflict in cases where two usernames would only differ on the 17th character or further, and Virtualmin will not be able to create the other one. The solution is name the user as short as possible in such case.