MySQL root password reset under Centos

Source: Internet
Author: User

There are many ways to reset the MySQL password, the official website also provides a very convenient way to operate, can reference resetting permissions. Here are the steps to reset your password in this article:

First, stop MySQL (if it is in a running state)

#service mysqld Stop output shutting down MySQL.                                       [  OK  ]

For #service mysqld Stop command, you can refer to the CENTOS 6.5 platform for offline compilation and installation of Mysql5.6.22.

Second, start Mysql_safe, so you can login MySQL without password

# Mysqld_safe--skip-grant-tables &/var/lib/mysqlmysqld_safe[6025]: Started

Third, login MySQL

# mysql-u root output Welcome to the MySQL Monitor.   ID 1 4.1. -debian_1-'help; ' ' \h '  for ' \c ' Clear The buffer.mysql>

Iv. Setting a new password

mysql> use mysql;mysql> Update user set Password=password ("new-root-password" where user='root'; MySQL> flush privileges;mysql> quit

Five, stop MySQL

#/etc/init.d/file /var/run/mysqld/mysqld.pidmysqld_safe[6186]: ended[1]+  done                    mysqld_safe--skip-grant-tables

Six, start MySQL and test the new password is correct

#/etc/init.d/-u root-p

Reference Address

Http://www.cyberciti.biz/tips/recover-mysql-root-password.html

MySQL root password reset under Centos

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.