Root password reset for MySQL

Source: Internet
Author: User

[[email protected] ~]# mysqladmin-uroot password ' 123456 ' set a password for MySQL
[[email protected] ~]# mysqladmin-uroot password ' 123456 ' local login MySQL

If we now have the MySQL password forgotten, reset it now.

[[email protected] ~]# vim/etc/my.cnf Edit configuration file
Skip-grant Join this Save to exit (do not authorize direct login)
[[email protected] ~]#/etc/init.d/mysqld restart reboot mysqlshutting down MySQL ..... success! Starting MySQL. success!
[[email protected] ~]# Mysql-uroot can log in Welcome to the MySQL Monitor directly. Commands End With; or \g.your MySQL connection ID is 1
mysql> use MySQL//using MySQL library mysql> update user set Password=password (' 654321 ') where user = ' root '; Update table (change password) mysql>quit

then find the/etc/my.cnf configuration file, delete the previous skip-grant command, Restart MySQL service after saving exit

[[email protected] ~]# /etc/init.d/mysqld restart 
[[email protected] ~]# mysql-uroot-p654321 Change Password to take effect, re-login Welcome to the MySQL Monitor. Commands End With; or \g.your MySQL connection ID is 1Server version:5.1.73 mysql Community Server (GPL) Copyright (c) +, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names trademarks of their respectiveowners. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.



This article is from "Linux rookie" blog, please be sure to keep this source http://490617581.blog.51cto.com/11186315/1758780

Root password reset for MySQL

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.