Most website software, including WordPress and most custom PHP applications, needs a MySQL database to store its content. Creating one involves three steps: creating the database itself, creating a database user, and linking that user to the database with the right privileges. The exact screens differ depending on your control panel.
In cPanel
- Log in to cPanel and open MySQL Databases.
- Under Create New Database, enter a name and click Create Database.
- Scroll to MySQL Users, enter a username and password under Add New User, and click Create User.
- Scroll to Add User To Database, select the user and the database you just created, then click Add.
- On the privileges screen, tick ALL PRIVILEGES unless your application specifically requires a narrower set, then click Make Changes.
In DirectAdmin
- Log in to DirectAdmin and open MySQL Management.
- Click Create new Database.
- Enter a database name, a username, and a password. DirectAdmin creates the user and links it to the database in this same step.
- Click Create.
The Details Your Application Will Ask For
Once created, most applications need the following during setup:
- Database Host: usually localhost
- Database Name
- Database Username
- Database Password
Both cPanel and DirectAdmin usually prefix your database and username with your hosting account's username automatically (for example, yourusername_dbname). Copy the full prefixed name exactly as shown, since a small typo here is the most common cause of a "database connection failed" error during setup.