Knowledgebase: How-To
Setting Up cPanel MySQL Database and User
Posted by on 13 June 2012 04:50 PM
Each database you use on your account needs to have a distinct name. Each database you connect to needs a database username assigned to the database so your scripts/website can connect to it. For this document, we'll assume you have the domain name, and your cPanel login/username is example.
Create a New Database
  1. Log in to cPanel using the URL:
    Note: if you forgot your login, let us know and we'll fix ya up.
  2. Click MySQL Databases in the Databases section

    MySQL Databases
  3. On the next screen navigate to the Create New Database section
  4. Type in a database name (let's call it 'mydb') in the empty text field and click Create Database
Your database name will automatically be prefixed with your cPanel username. Anytime you need to reference the database, it will look like this: example_mydb.
Create a Database User
Each database needs a username to allow connections. To create a database user:
  1. Log in to your cPanel account
  2. Click MySQL Databases and scroll down to the MySQL Users section

     Create User
  3. In the Add New User section type in a new database username and password
    Note: we'll assume you are using 'dbuser' with password 'user123'
  4. Click Create User
Your database username will automatically be prefixed with your cPanel username, so be sure to reference the full username in your scripts:

     User: example_dpuser
     Pass: user123
Add User to Database
Finally, you need to associate the new username with the database. To do so:
  1. Scroll down to the Add Users to Your Databases section

    Add User
  2. Select 'example_dbuser' from the dropdown menu on the left and the database 'example_mydb' from the dropdown menu on the right
    Note: you're just selecting the user you want to move to another database, and then selecting the database you want to move that user to. 
  3. Click Add
That's it. You've created a database, a database user and connected the two together. Here's the information you will use for your scripts (such as Wordpress or vBulletin):

   server: localhost
   database: example_mydb
   database user: example_dbuser
   database password: user123

 create user.png (27.37 KB)
 mysql databases.png (27.32 KB)
 add user.png (20.14 KB)
(6 vote(s))
This article was helpful
This article was not helpful

Comments (1)
Sam Cohen
04 November 2012 03:29 PM
Thanks so much for these helpful articles. My sister talked me into using WordPress and asmallorange together and I'm in totally new territory (for me). Thanks for knowing what you're doing and sharing your knowledge.
Post a new comment
Full Name:
Help Desk Software by Kayako fusion