How to Create or Delete MySQL Database and a User?

You can run easily many web-based applications such as bulletin boards, content management systems and online retail shops via databases.

Note: The length of usernames is up to 16 characters. Take in mind that MySQL Databases and Usernames will only include the first 8 characters, as shown examples:
  • cPanel username: username
  • MySQL Database: something_user
  • MySQL Username: user_something
Jump to a Section

It is effortless and very easy to create the database and the database user, and assign that user to your new database. It’s very useful for someone looking to manually install third party programs which make use of MySQL databases.

1.Create or Delete a MySQL Database

1.1.Create a MySQL Database

1. Log into cPanel.
2. Then select MySQL Databases.
3. Write a name for the database in its new field.
4. Click Create Database.
5. Finally, Go Back.
6. The new database will be shown in the Current Databases table.

1.2.Delete a MySQL Database

1. Go to the Current Databases section of MySQL Databases.
2. In the Actions column of the table, choose Delete Database as shown in the picture below:

Here, you can remove a user that has been assigned to a database by clicking the X. Below in this article we also describe how to assign a database user.

2.Create or Delete a Database User

Now you are ready to create a user and assign privileges to him. Don’t forget that MySQL user accounts must be created separately from mail and web administrator accounts.

2.1.Create a Database User

1. Log into cPanel.
2. Then select MySQL Databases.
3. Click Jump to MySQL Users (it’s located in the top-right corner of the page).
4. Write a username under Add New User as shown below:

5. Choose and write a strong password in the Password field.
6. Retype it again.
7. Click Create User.

2.2.Delete a Database User

1. Go to the Current Users section.
2. By choosing the X next to the user as shown below in the picture, you will delete him:

3.Define a User's Privileges

Privileges give different access to the database, e.g. they will allow a user to add or to delete information.

3.1.Assign Privileges to Database User

1. Log into cPanel.
2. Then select MySQL Databases.
3. The next step is to select a user from the User drop-down menu.
4. Then select the database from the Database drop-down menu, where the user will have access.
5. Click Add.
6. From the MySQL Account Maintenance screen, choose some of privileges that will give to the user or select All Privileges as shown in the picture below:

7. Finally, click Make Changes.

3.2.Unassign a User from a Database1. Go to the Current Databases section.

2. Select the database that wish to modify.
3.  Choose the X next to the user you wish to unassign.
4.Using the Database

As a result you know how to create databases and users and assign appropriate privileges. You can continue your learning with editing and connecting of your databases.

Was this article helpful?

mood_bad Dislike 92
mood Like 92
visibility Views: 2184