Although most application installers like Wordpress in Installatron create a database automatically, there may be times when you need to create one for development, testing or troubleshooting. You can create databases in phpMyAdmin or using a commands in a Terminal, or by going navigating to cPanel > Databases > MySQL Databases. This article covers how to create databases and add users using the cPanel MySQL interface.
Create New Database
To create a database from cPanel > Databases > MySQL Databases, click the link to enter that interface.
Create New Database: enter a name for the database. The username in the account is automatically added as a prefix for example in the format (username_)mydatabase. Click Create Database to finish.
Add New User
Databases need an associated user with all privileges set to modify it. You can create a database user for each database. It is common practice to use the same name for the user as the database itself. Or you can have one database user that is added to several databases. The first step is to Add New User:
The username again is autofilled so enter the name to match the database or something else you prefer. Use the Password Generator or enter one manually. Then click Create User. Once a database user is created, then there is another step to Add User to Database.
Add User to Database
Select the desired User and Database from the dropdown menus to add them to the database. Then click Add. Then select the Privileges the user will have.
Select ALL PRIVILEGES or only select ones from the list. Then click Make Changes to finish.
More articles about Databases
- Database Management in cPanel
- How to Give Additional Users Database Access
- MySQL Database Export Backup and Import Restore Methods
- Understanding MySQL User Permissions