Creating a MySQL Database and User Print

  • 0

Most applications — WordPress, Joomla, Laravel, custom PHP — need a database plus a user assigned to it.

Step 1: Create the database

  1. In cPanel, open Databases → MySQL® Databases.
  2. Under Create New Database, type a name, for example wp1.
  3. Click Create Database. The real name is prefixed with your cPanel username, for example cpuser_wp1.

Step 2: Create a database user

  1. Scroll to MySQL Users → Add New User.
  2. Enter a username and a strong password. Save the password somewhere safe.
  3. Click Create User. The full username is also prefixed, for example cpuser_wpadmin.

Step 3: Assign the user to the database

  1. Under Add User To Database, pick the user and the database.
  2. Click Add, tick ALL PRIVILEGES, then Make Changes.

Connection settings for your application

  • Host: localhost
  • Database name: cpuser_wp1 (with prefix)
  • Username: cpuser_wpadmin (with prefix)
  • Password: the one you set
  • Port: 3306

Importing an existing database

Open phpMyAdmin from cPanel, select the empty database on the left, click Import, choose your .sql file and click Go. If the file is too large to upload, compress it to .sql.gz or send it to us on a ticket and we will import it for you.

Remote connections

By default only localhost can connect. To connect from your office or laptop, add your IP under Remote MySQL in cPanel.


Was this answer helpful?

« Back