How to encrypt root password in MariaDB?

2019-08-06 02:39发布

问题:

I have three users in MariaDB namely root, testuser1, testuser2. I want to encrypt the passwords for all three users when connecting to MariaDB by typing the following command in the terminal,

1. mysql -u root -p
2. mysql -u testuser1 -p
3. mysql -u testuser2 -p

It asks for password. At this point, How can I supply encrypted password or make it read from any file which may contain it?

There is a requirement in my project to encrypt all passwords for MariaDB users. (I have also asked this question in connection with MySQL too).