SQL password issue when migrating to new server
I'm in the process of moving all our users onto a new server and due to the versions of MYSQL being different between the two our users database passwords are getting reset to a random string. Most of our users aren't too technically literate and would have no idea what their database passwords were without consulting a Web Developer which will cost them money.
I'm wondering if anyone has any neat tricks for finding the database passwords?
I know I can't get them out of MYSQL as they are irreversibly encrypted but I was thinking that I may be able to find a few them in the users config files, the one liner below is what I have so far but it's spitting out way more lines than just what I want.
egrep -r -H "password|Password|PASSWORD" /home/ |egrep "db|DB|db|database"
I'm also wondering if there is an easy way to make mysql on the old server convert all it's passwords to the new longer hashes but from the reading I have done so far that would require knowing the old passwords.
So If anyone has any suggestions or guidance that would be great!
-
Hello :) The method you are planning to use (obtaining the password from the script configuration files) is likely the most reliable method. It might be time-consuming, but many applications do store the database password in a configuration file in plaintext. Thank you. 0 -
Sorry for bumping an older thread but I thought the below script may help for others in the same situation, it currently finds WordPress and Joomla passwords in the root of a users public_html. It's not pretty as I couldn't be bothered to fix egrep for the Joomla search but it works! #!/bin/bash cd /home/ users=($(ls -d */ |grep -v tmp)) for user in "${users[@]}" do path=/home/$user'public_html/' if [ -f $path'wp-config.php' ] then printf '\n%s\n' 'WORDPRESS config found for user '$user cat $path'wp-config.php' |egrep "DB_NAME|DB_USER|DB_PASSWORD" elif [ -f $path'configuration.php' ] then printf '\n%s\n' 'JOOMLA config found for user '$user cat $path'configuration.php' |grep "\$db " cat $path'configuration.php' |grep "\$user " cat $path'configuration.php' |grep "\$password " fi done0 -
Thank you for taking the time to provide that workaround. 0
Please sign in to leave a comment.
Comments
3 comments