Knowledge Base Article

How to reset the password for a MySQL database?

You may need to change the password of your database 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. In order to do so you have to:

* Log in your cPanel -> MySQL Databases. Find the database in the question and see which is the attached user to it. For example we will consider that your database is called yourusername_database and the 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 user yourusername_user.

You will be asked the following question:

Are you sure you wish to permanently remove user yourusername_user?

Click on the Delete User button to confirm your intention. Then you should create a new database user;

* Go back to cPanel -> MySQL Databases and create a new user:

Type the same name (user) for username and type (or generate) the new password for it;

* 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 add the user to the database/s and grant all privileges for it.

NB: Note that if the database is used by a script you will have to reconfigure it to work with the new password via its configuration file. If you are not certain how to do this, you can post new ticket in the SiteGround's Help Desk and we will gladly assist you.

You can find more details on how to create MySQL databases/users in our MySQL tutorial:

http://www.siteground.com/tutorials/php-MySQL/MySQL_database_user.htm

We strongly recommend you to create a full backup of your website prior of making any major changes:

http://kb.siteground.com/article/How_can_I_create_a_full_backup_of_my_website_.html



Rating

Please indicate if this article was helpful for you.

rating :  4.5 from 5
views :  457
votes :  2

Haven't found what you are looking for? Suggest an article HERE.

powered by

Valid XHTML 1.0 Strict Valid CSS!