How to set password for users in MySQL database
MySQL database how to set passwords for users, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
How to set password for users under MySQL database
First we should know that the password store in the Mysql database must be encrypted with the password () function. Because passwords are stored in the user table in encrypted form, not as plain text. If you don't have encryption, execute the following statement directly in the database:
Usemysql
Insertintouser (host,user,password) values ('%', 'user_name','yourpassword')
Flushprivileges
I believe the result will not satisfy you. Because the server compares encrypted values, the server connection must fail. What needs to be noted here is that the command flushprivileges; reloads the authorization table. You can also use mysqladmin-urootreload or mysqladmin-urootflush-privileges directly under shell to reload the authorization table.
How to set password for users under MySQL database
In the Mysql environment, you can use the following statement to set the password:
1.insertintouser (host,user,password) values ('%', 'user_name',password ("yourpassword")
2.setpasswordforuser_name=password ("yourpassword")
Both of the above methods must overload the authorization table.
3. Of course, you can also set the password directly when you create a user, and the grant statement will automatically encrypt the password for you.
Such as: grantallon*.*touser_name@%identifiedby "yourpassword"
In addition, you can also use the mysqladmin program to set the password in the shell environment
Such as: mysqladmin-urootpassword "yourpassword"
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.