MySQL forgot root password do not restart Mysqld method
1, first there must be a MySQL database account that can have the right to modify, the current MySQL instance account (lower-privileged accounts, such as can modify the Zabbix database) or other instances of the same version of the account. Copy the files associated with the user table below the Data/mysql directory to the Data/zabbix directory.
[email protected] mysql]# CP mysql/user.* test/
[Email protected] mysql]# chown mysql.mysql test/user.*
2. Use another low-privileged account link database to set the user-stored password data in the Zabbix database.
[Email protected] mysql]# mysql-uzabbix-pzabbixpasswd-a
MySQL: [Warning] Using a password on the command line interface can is insecure.
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 1180
Server Version:5.7.22-log MySQL Community Server (GPL)
Copyright (c), 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
mysql> use Zabbix;
Database changed
mysql> Update user Set Authentication_string=password (' zabbixpasswd ') where user= ' root ';
Query OK, 2 rows affected, 1 warning (0.04 sec)
Rows matched:2 Changed:2 warnings:1
3, the user after the change. MyD and user.myi Copy to the MySQL directory, remember to back up the previous files.
MV Mysql/user. MYD Mysql/user. Myd.bak
MV Mysql/user. MYI Mysql/user. Myi.bak
CP Zabbix/user. my* mysql/
Chown Mysql.mysql mysql/user.*
4, Kill-sighup
[[email protected] mysql]# pgrep-n MySQL
31650
[Email protected] mysql]#
[Email protected] mysql]# Kill-sighup 31650
5. Testing
[Email protected] mysql]# mysql-uroot-pzabbixpasswd-a
MySQL: [Warning] Using a password on the command line interface can is insecure.
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 1190
Server Version:5.7.22-log MySQL Community Server (GPL)
Copyright (c), 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
MySQL forgot root password do not restart Mysqld method