How to Create a MySQL Database and User in cPanel Print

  • 0

Most web applications, including WordPress, store their content in a MySQL database. This article shows you how to create a database, create a database user and give that user access, which you'll need before installing an app by hand or moving a site to EDZNET.

If you're installing WordPress, you don't need to do this: WordPress Toolkit creates the database for you.

The quick way: MySQL Database Wizard

  1. Log in to cPanel and go to Databases › MySQL Database Wizard.
  2. Enter a name for the new database and click Next Step.
  3. Enter a username and a strong password (the Password Generator is handy), then click Create User.
  4. Tick ALL PRIVILEGES and click Next Step. The database and user are now linked and ready to use.

Step by step: MySQL Databases

Use this page when you want to add a user to an existing database, or manage several databases at once.

  1. Go to Databases › MySQL Databases.
  2. Under Create New Database, enter a name and click Create Database.
  3. Under MySQL Users › Add New User, enter a username and password, then click Create User.
  4. Under Add User To Database, choose the user and the database, then click Add.
  5. On the Manage User Privileges screen, tick ALL PRIVILEGES and click Make Changes.

Good to know

  • Names are prefixed. cPanel adds your cPanel username and an underscore to every database and database user. If your cPanel username is example and you create a database called shop, its full name is example_shop. Always use the full name in your app's settings.
  • The database host is localhost. Your app runs on the same server as the database, so use localhost as the host name.
  • Keep a note of the details. Your app needs the full database name, full username and password. For WordPress these go in wp-config.php as DB_NAME, DB_USER, DB_PASSWORD and DB_HOST.
  • A database user can be linked to more than one database, but giving each app its own user is safer.

To bring in data from an existing site, see how to import and export a database with phpMyAdmin.


Was this answer helpful?

« Back