MySQL failure--forgot how to retrieve the password

Source: Internet
Author: User

    1. shut down the database directly under single instance
    2. the process of killing the corresponding instance in multiple instances , such as 3306

[[Email protected] ~]# PS aux |grep mysql

Root 10384 0.0 0.0 106244 1416? S 18:48 0:00/bin/sh/usr/local/mysql/bin/mysqld_safe--defaults-file=my.cnf

MySQL 11370 0.0 29.8 1061116 567060? Sl 18:48 0:09/usr/local/mysql/bin/mysqld--defaults-file=my.cnf--basedir=/usr/local/mysql--datadir=/data/mysql/ 3307/data--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=/data/mysql/3307/mysqld_3307.err-- open-files-limit=1024--pid-file=/data/mysql/3307/mysqld.pid--socket=/data/mysql/3307/mysql.sock--port=3307

Root 12618 0.0 0.0 106248 1472? S 19:27 0:00/bin/sh/usr/local/mysql/bin//mysqld_safe--defaults-file=/data/mysql/3306/my.cnf

MySQL 14472 0.0 6.5 637228 125068? Sl 21:58 0:03/usr/local/mysql/bin/mysqld--defaults-file=/data/mysql/3306/my.cnf--basedir=/usr/local/mysql-- Datadir=/data/mysql/3306/data--plugin-dir=/usr/local/mysql/lib/plugin--user=mysql--log-error=/data/mysql/3306/ Mysqld_3306.err--open-files-limit=48--pid-file=/data/mysql/3306/mysqld.pid--socket=/data/mysql/3306/mysql.sock --port=3306

Root 15038 0.0 0.0 103316 832 pts/1 s+ 23:50 0:00 grep mysql

[[email protected] ~]# kill 14472

    1. Restart with command

[Email protected] ~]#/usr/local/mysql/bin/mysqld_safe--defaults-file=/data/mysql/3306/my.cnf--skip-grant-table &

[Email protected] ~]# mysql-s/data/mysql/3306/mysql.sock

mysql> UPDATE user SET Password=password (' zckj.com ') WHERE user= ' root ';

Query OK, 0 rows Affected (0.00 sec)

mysql> FLUSH privileges;

Query OK, 0 rows Affected (0.00 sec)

Note: The--skip-grant-table parameter under multiple instances must be started behind the MY.CNF parameter

    1. after normal exit, re-start normally, or take the--skip-grant-table parameter

MySQL failure--forgot how to retrieve the password

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.