How To Reset MySQL Root Password In REDHAT 8.5
- 00:02 cat /etc/os-release
- 00:17 mysql -u root -p
- 00:41 systemctl stop mysqld
- 00:56 mysqld --skip-grant-tables --user=mysql &
- 01:05 mysql -u root
- 01:12 flush privileges;
- 01:23 alter user 'root'@'localhost' identified by 'Linuxc#4';
- 01:49 \q
- 01:54 ps -aux
- 02:02 kill -9 35564
- 02:18 systemctl start mysqld
- 02:35 mysql -u root -p
- 02:52 flush privileges;
To Reset MySQL Root Password On REDHAT 8.5
Introduction:
MySQL is a well-known open-source relational database management system developed, distributed, and supported by Oracle Corporation which is used with PHP.
Step 1: Check the installed version of OS by using the below command
[root@linuxhelp ~]# cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.5 (Ootpa)"
Step 2: Try to login MySQL as root user by using the below command
[root@linuxhelp ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Notes: am Forget my my sql password
Step 3: Stop MySQL Service by using the below command
[root@linuxhelp ~]# systemctl stop mysqld
Step 4: Run the below command to bypass MySQL authentication
[root@linuxhelp ~]# mysqld --skip-grant-tables --user=mysql &
[1] 35564
Step 5: Login MySQL server as a root user by using the below command
[root@linuxhelp ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Server version: 8.0.26 Source distribution
Step 6: Flush the Privileges by using the below command
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
Step 7: Alter the password for root user by using the below command
mysql> alter user 'root'@'localhost' identified by 'Linuxc#4';
Query OK, 0 rows affected (0.01 sec)
Step 8: Quit MySQL server by using the below command
mysql> \q
Bye
Step 9: Check the MySQL Background process by using the below command
[root@linuxhelp ~]# ps -aux
root 190 0.0 0.0 0 0 ? S 18:02 0:00 [irq/27-pciehp]
root 191 0.0 0.0 0 0 ? S 18:02 0:00 [irq/28-pciehp]
root 192 0.0 0.0 0 0 ? S 18:02 0:00 [irq/29-pciehp]
root 193 0.0 0.0 0 0 ? S 18:02 0:00 [irq/30-pciehp]
root 194 0.0 0.0 0 0 ? S 18:02 0:00 [irq/31-pciehp]
root 35289 0.0 0.0 0 0 ? I 18:27 0:00 [kworker/0:0-events_power_efficient]
mysql 35564 0.8 10.0 1814108 382488 pts/1 Sl 18:28 0:01 mysqld --skip-grant-tables --user=mysql
root 35695 0.0 0.0 7316 908 ? S 18:30 0:00 sleep 60
root 35732 0.0 0.1 61660 4112 pts/1 R+ 18:30 0:00 ps -aux
Step 10: Kill The MySQL Background process by using process id
[root@linuxhelp ~]# kill -9 35564
[1]+ Killed mysqld --skip-grant-tables --user=mysql
Step 11: Start the MySQL service by using the below command
[root@linuxhelp ~]# systemctl start mysqld
Step 12: Login MySQL as a root user by using the below command
[root@linuxhelp ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Step 13: Flush the privileges by using the below command
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
Step 14: Quit
mysql>\q
Bye
Conclusion:
We have reached the end of this article. In this guide, we have walked you through the steps required to Reset MySQL Root Password on REDHAT 8.5. Your feedback is much welcome.
Comments ( 0 )
No comments available