How To Create or Delete a MySQL Database or User

How To Create a MySQL Database

  • Log in to cPanel.
  • Look for the Databases section, then click MySQL Databases.

  • Give your database a name in the New Database field.

  • Click Create Database.
  • Click Go Back.
  • In the Current Databases area, the new database will display.

How To Delete a MySQL Database

  • Navigate to the Current Databases section of MySQL Databases.
  • Click Delete next to the database you want to delete in the table’s Actions column.

  • Confirm that you want to delete the database permanently.

What is a MySQL User, and Why is it Important?

The MySQL user is an authentication-related record in the MySQL server. This is not the same as the usernames you use to log into Windows or your cPanel/WHM account. Because you may set rights to each user when you create a MySQL user, your website’s databases are more secure. Except for you, the website’s owner, you don’t want to provide anyone with complete access to your database.

You’ll need to create a user and assign privileges after you’ve created the database. MySQL user accounts must be created independently from mail and web administrator accounts.

How To Create a Database User

  • Log in to your cPanel account.
  • Locate the Databases section and select MySQL Databases.

  • In the top-right corner of the page, click the Jump to MySQL Users link. You can also go to the MySQL User section by scrolling below.

 

  • Enter a username under Add New User.

  • In the Password field, type a password.
  • Click the Generate Password button for assistance in creating a strong password.
  • After you’ve confirmed your password, click the Create User button.

Define a User’s Privileges and Their Relevance

To do website maintenance operations like running queries or changing databases, you’ll need certain users with rights. This is the point at which we grant privileges. The way a user interacts with the database is determined by his or her privileges. Privileges, for example, determine whether or not a person can add or delete data.

  • Log in to your cPanel account.
  • Locate the Databases section and select MySQL Databases.

  • Select the database you want to give the user access to from the Database dropdown menu.
  • Select Add from the drop-down menu.
  • Select the privileges you want to give the user on the next screen, or just select ALL PRIVILEGES.

  • Click Make Changes, then click Go Back.

How To Unassign a User from a Database

  • Navigate to the Current Databases section of MySQL Databases.
  • Locate the database that you want to change.
  • Click the trash icon in the Privileged Users column for that database.