How to reset the password for a MySQL database?

You may need to change the password of your database in order to improve the security of your website or if your account has been compromised by hackers. Basically the easiest way to change the password for your database is to recreate the MySQL user attached to it. You can use the following instructions to do so:

  • Log in your cPanel -> MySQL Databases. Find the corresponding database and see which is the user attached to it. 
    • Find the corresponding database and see which is the user attached to it. For example we will consider that your database is called yourusername_database and the database user attached to it is yourusername_user.
    • Scroll to the bottom of the page and you will see a field called Current Users. There is a little circle with X in it – press it to delete the database user yourusername_user.

You will be prompted to confirm this action:

Are you sure you wish to permanently remove user yourusername_user?

Click on the Delete User button in order for the database user to be successfully deleted.

Then you should create a new database user:

  • Go back to cPanel -> MySQL Databases and create a new user:
  • Type the same database username and type (or generate) the new password for it. Bear in mind that you will be able to change only the user part of the database name yourusername_user. The prefix yourusername_ is added by default by the system.


When the MySQL user is created you have to attach it to your database/s. On the same page you will find a section called Add User To Database – just assign the database user to the desired database/s and grant all privileges for it.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How do I park a domain name?

Add a Parked domain:Step 1. To access the Parked Domains feature, click on the corresponding icon...

How to change the password of a Mysql user in cPanel?

Step 1. Log in to your cpanelStep 2. Under the Databases heading, click the MySQL Databases...

How to create a Mysql database?

Creating a PostgreSQL database is a straight-forward process. All you need to do is log in to...

How to create a Mysql user?

In order to create a MySQL user you should go to your cPanel -> MySQL Databases interface.In...

How to export/import a MySQL database via SSH

In this article we will show you how to export and import a MySQL database via SSH. Managing your...