Home / Guides / Your site

3 min read ยท Updated

Create a MySQL database

Most web apps need a database. This guide walks through creating one in cPanel and connecting a user to it.

When you need this

If you installed WordPress or another app through Softaculous, the database was created for you automatically. This guide is for when you're setting up a custom PHP app, a framework like Laravel, or anything else that needs its own database.

Create the database

  1. In cPanel, open MySQL Databases.
  2. Under Create New Database, type a name (cPanel prefixes it with your account name, so myapp becomes something like username_myapp).
  3. Click Create Database.

Create a database user

  1. On the same page, scroll to MySQL Users > Add New User.
  2. Choose a username and a strong password. Use the password generator if you like.
  3. Click Create User.

Connect user to database

  1. Scroll to Add User To Database.
  2. Select the user and the database you just created.
  3. Click Add.
  4. On the privileges screen, tick ALL PRIVILEGES and click Make Changes.

Use it in your app

Your app's config will ask for four things:

  • Host: localhost
  • Database: the full prefixed name, e.g. username_myapp
  • Username: the full prefixed username
  • Password: the password you set above

Browse your data

Open phpMyAdmin from cPanel to view tables, run queries, and import or export data.

← All guides

Stuck on a step? Email support@dredgehost.com and we'll help you sort it out.

Did this guide help? A short review on Trustpilot helps other people find a small host they can trust.