MySQL password settings and reset method

Source: Internet
Author: User


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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.