Note mysql running process. Copy mysqld_safe executed process
ps ax | grep mysqlStop running mysql process.
/etc/init.d/mysql stopAppend skip-grant-tables at the end of the mysqld_safe process and execute mysqld_safe manually with command below.
/usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/oel1.localdomain.pid --skip-grant-tablesOn next terminal window, login to mysql as user root without password.
[root@oel1 ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.10-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Reset mysql password with command below.
mysql> update mysql.user set password=PASSWORD('P@ssw0rd5308')
-> where user='root';
Query OK, 4 rows affected (0.01 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql>
Reload privileges with Flush privilege command.
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
Kill the existing running mysql process.
[root@oel1 ~]# ps ax | grep mysql | grep -v grep | awk '{print $1}' | xargs kill
Start mysql process now you can login with new password
mysql -u root -pP@ssw0rd5308 -h 127.0.0.1
No comments:
Post a Comment