How to change the database user password – cPanel?

Changing the database user password using bash script?

Change the database user password, need simple solution!!

The MySQL community has depreciated “old_passwords” option since MySQL 5.6 version.

So we won’t be able to recollect the password from an old password hashing format.

So, once we upgrade the MySQL server version to 5.6 (or above) we can not reuse the MySQL user passwords which are still using old password technique (old hash format).

What are password hashes?

It is insecure to store plain text passwords in the password database.

We (new technology hackers :P) can simply recreate those old hashed password simply using their tools. So, since 5.6 MySQL strictly depreciated the old_password option to use the old format password.

Once, we upgrade the MySQL version in server, the websites using old password hash will not work. The site through db connection error.

Error Establishing a Database Connection

You can fix this error simply by updating the database user password with its current password. You will get the password details from its configuration file.

How to create a New Database-user and Grand Permissions – MySQL

We already discussed about the creation of MySQL DB and DB users. Here I am explaining the commands which are using to Grand Privileges to users for accessing the Databases in your server.

Enter the mysql prompt by following the step below:

# mysql -u root -p

It then prompts for password. Enter the MySQL root password.

Read more…

How to change the database user password from cPanel?

This is really simple. Please do the following steps:

1. Log into cPanel.

2. Click on “MySQL databases” under databases tab.

How to change the database user password?
How to change the database user password?

3. Scroll down. There is an option to change db user password.

How to change the database user password?
How to change the database user password?

Yeah.. change/update the database user password from here.. That’s it!!

How to change the database user password using bash script? If you have a lot of db users and a lot of websites on your server, please try the following bash script to change the database user password. This should be helpful to save a lot of time.

I wrote this simple bash script to find out and update the db user password from Linux command line. I am not a super coder 😛 However, you can trust me, I tested this on my site in live environment. Simply do the following steps.. Read more…

Just create an executable file and paste the code into it and execute, explore!!!

echo "This script is useful for only commonly using CMSs like WP, Joomla, Drupal, Magento, Drupal etc with known configuration location. If nothing listing and you are getting db conntction error check configuration manually.. Thanks by Arunlal"
echo "" > details.txt
echo "Please enter the cPanel username: "
read username
grep -irl ${username}_ /home/$username/*{wp-config,configuration,config,,db-config,,configure,mysql.class,Settings}.php /home/$username/*/{wp-config,configuration,config,,db-config,,configure,mysql.class,Settings}.php /home/$username/*/*/{wp-config,configuration,config,,db-config,

Git it :

That’s it buddies!

, ,

Post navigation

Arunlal A

Senior System Developer at Zeta. Linux lover. Traveller. Let's connect! Whether you're a seasoned DevOps pro or just starting your journey, I'm always eager to engage with like-minded individuals. Follow my blog for regular updates, connect on social media, and let's embark on this DevOps adventure together! Happy coding and deploying!

3 thoughts on “How to change the database user password – cPanel?

Leave a Reply

Your email address will not be published. Required fields are marked *