If you need to dump all mysql users created on your linux machine you can do it quite easy, using a simple bash script.

Create a new bash script as follows:

 Save the file, chmod +x dump_sqlusers.sh. Then just execute the script! It will dump all your users right on the screen. If you want to save that to a file, you can just execute the script and redirect the output to a file like this:

root@zira# sh dump_sqlusers.sh > sqlusers.sql

{user} = your root mysql user, or a mysql user that has full rights
{password} = the password of that user

Obviously, this script exports only the users and their permissions, the passwords are encrypted and you have to know them.


About Author

I am a linux passionate and currently working as a Linux Senior System Administrator. I also am a freelancer and help people to complete different jobs. You can hire me on Freelancer.com