MySQL forgot password what to do

Source: Internet
Author: User

If one day you forget the root password, we can use--skip-grant-tables this parameter, specifically implemented as follows:


[Email protected] bin]# mysql-uroot-p

Enter Password:

ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)

[[email protected] bin]# ps-ef|grep MySQL

Root 7572 2398 0 00:58 pts/1 00:00:00/bin/sh./mysqld_safe--defaults-file=/etc/my.cnf

MySQL 8199 7572 0 00:58 pts/1 00:00:00/usr/local/mysql/bin/mysqld--defaults-file=/etc/my.cnf--basedir=/ Usr/local/mysql--datadir=/data/mysql--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=/data/ Mysql/error.log--open-files-limit=3072--pid-file=/data/mysql/he1.pid--socket=/data/mysql.sock--port=3306

Root 8230 2398 0 00:59 pts/1 00:00:00 grep mysql

[Email protected] bin]# kill-9 8199 7572

[[email protected] bin]# ps-ef|grep MySQL

Root 8232 2398 0 00:59 pts/1 00:00:00 grep mysql

[1]+ killed./mysqld_safe--defaults-file=/etc/my.cnf

[[email protected] bin]# ps-ef|grep MySQL

Root 8234 2398 0 00:59 pts/1 00:00:00 grep mysql

[Email protected] bin]# /mysqld_safe--defaults-file=/etc/my.cnf--skip-grant-tables &

[1] 8235

[[email protected] bin] #160317 00:59:43 mysqld_safe Logging to '/data/mysql/error.log '.

160317 00:59:43mysqld_safe starting mysqld daemon with databases From/data/mysql

[Email protected] bin]# mysql-uroot

Welcome to the Mysqlmonitor. Commands End With; or \g.

Your mysqlconnection ID is 1

Server Version:5.6.16-log MySQL Community Server (GPL)

Copyright (c) 2000,2014, Oracle and/or its affiliates. All rights reserved.

Oracle is aregistered trademark of the Oracle Corporation and/or its

Affiliates. Othernames may trademarks of their respective

Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql> quit

Bye

[[email protected] bin]# MySQL

Welcome to the Mysqlmonitor. Commands End With; or \g.

Your mysqlconnection ID is 2

Server Version:5.6.16-log MySQL Community Server (GPL)

Copyright (c) 2000,2014, Oracle and/or its affiliates. All rights reserved.

Oracle is aregistered trademark of the Oracle Corporation and/or its

Affiliates. Othernames may trademarks of their respective

Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

Mysql> quit

Bye


This article uses the Kill-9 method, this method does not recommend in the production library to use, the production library should adopt the normal stop the library

This article is from the "Age volt" blog, please make sure to keep this source http://suifu.blog.51cto.com/9167728/1753985

MySQL forgot password what to do

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.