Announcements
Welcome to Servikus Tutorials Area! You will find a ton of useful tutorials in our tutorial area. We hope that you will find them useful! If you want custom tutorial created, please let us know and we will create it for you!
-
Advanced tutorials
Tutorials aimed for advanced users and, mostly, Dedicated Servers owners.
-
Basic tutorials
-
cPanel
cPanel related tutorials
-
Domain tutorials
-
WordPress
WordPress related (installation, plugins, tips etc)
How to create database and user for MySQL and give user permissions in cPanel
Now days almost all websites use MySQL to store information and most of the scripts have auto install options. Anyway, auto install option can’t create database and user for your database and that is something that you need to do yourself. In this simple tutorial we will show you how to create database and user, and then give user proper permissions to database.
First of all you should start by logging in to your cPanel hosting account.
-
Go and click on MySQL Databases icon as shown on the image below:
-
New page will open, on the new page find the box that says “Create New Database” and add name to your database, for this example name of database is “mydb1”. Click on Create Database button.
-
New page will open with result of your database creation as shown on the image below. Please note that your full database name is actually userdoma_mydb1 and not mydb1 as you named it, because of the prefix that each cPanel database and username have.
You have now successfully created database. Now you need to create user and then give user proper permissions. Click on the Go Back button.
-
Find section that says MySQL Users -> Add New User as shown on the picture below
- Fill in username field (in our case we have named user: user1), for password use password generator or enter your own password. We have used password generator. Click Create User button.
-
New page will appear with username and password in our case sample is shown on the image below. Click Go Back button.
Now after creating database and user, you do need to give user permissions to access that database.
-
Find section that says Add User to Database as shown on the image below
- Select user that you want to add (in our case: userdoma_user1)
- Select database that you want to add user to (in our case: userdoma_mydb1)
-
Click Add. New page will load titled “Manage User Privileges”
- On the new page you are able to select permissions for your DB user. We have selected all privileges for our user. Click on Make Changes.
-
New page will appear with result of your action as shown on the image below.
- Click Go Back button.
-
If you want to check if your user is there just scroll and look for part that says “Current Databases” and you will be able to see list of all your databases and users who are allowed to access them as shown on the picture below
That’s all! You have just learned how to create database in cPanel, add user, and give user privileges to the database.
============================================================================