mysql password settings and reset method
Author: Xiao Liu
Today in this article, let's take a look atMySQLDatabase password settings, when we accidentally forgot the root password, is a very bad thing, hope this article can help everyone, we start with the password set!
We just installed it.MySQLDatabase, the default root password is empty, then we can use the command to set the password
mysqladmin-u root password "password"
(Password is 123456 for root setting)
If you know the old password, we can change it directly with the following command.
Mysqladmin-u root-p ' old password ' password ' new password ' (quotation marks can be omitted)
When we forget.MySQLRoot password, the following prompt
We can use the steps to reset the password.
Stop itMySQLService
Service Mysqld Stop
Use the following command to start the security modeMySQLService
Mysqld_safe--skip-grant-tables >/dev/null 2>&1 &
Skip Password Verification Direct modificationMySQLThe user table
Wait 20 seconds after
LoginMySQL(The following sentence means to log in to theMySQLThis database)
MySQL-U RootMySQL
Mysql>flush privileges; Refreshing the database
ExitMySQLLogin
RestartMySQLYou can sign in with this new password.
Service mysqld Restart
Although this method is easy to use, but still try to remember your password, otherwise it may be in your password to reset this empty file, there may be a conscientious attack oh, because when we start using MysqlsafeMySQLIs the least secure ...
Reproduced:Http://bbs.77169.com/read-htm-tid-321971-keyword-mysql.html