How to Reset MySQL internal Root Password
search cancel

How to Reset MySQL internal Root Password

book

Article ID: 92946

calendar_today

Updated On:

Products

STARTER PACK-7 CA Rapid App Security CA API Gateway

Issue/Introduction



How to reset MySQL root password?

Environment

Env: 9.2
MySQL : 5.6

Resolution

Please follow the instructions below to reset the root password of MySQL
Go to ssgmenu
1. Use a privileged shell (root) using Option 3 
2. Log into Linux prompt 

Changing the root password: 

The following command will let you change the mysql root password: 
   mysqladmin password "{newPass}" 

After you do this, you need to do a vi on /root/.my.cnf and change the mysql password saved in there to ensure proper functionality. 

Alternate Root Password: 
[root@ssg-sayeed ~]# service ssg stop 
Shutting down Gateway Services: [ OK ] 

[root@ssg-sayeed ~]# service mysql stop 
Shutting down MySQL.... [ OK ] 

[root@ssg-sayeed ~]# service mysql start --skip-grant-tables 
Starting MySQL. [ OK ] 

[root@ssg-sayeed ~]# mysql 

mysql> UPDATE mysql.user SET Password=PASSWORD('7layer') WHERE User='root'; 
Query OK, 0 rows affected (0.00 sec) 
Rows matched: 1 Changed: 0 Warnings: 0 

mysql> FLUSH PRIVILEGES; 
Query OK, 0 rows affected (0.00 sec) 

mysql> exit 
Bye 

[root@ssg-sayeed ~]# service mysql restart 
Shutting down MySQL..... [ OK ] 
Starting MySQL. [ OK ] 

[root@ssg-sayeed ~]# service ssg start 
Starting Gateway Services: [ OK ] 

To make 'mysql' drop you directly into a mysql prompt after a new root password is selected, edit vi /root/.my.cnf 

DEFAULT VALUES: 
- root/7layer 
- gateway/7layer 
- repluser/replpass