How to reset MySQL 8 root password on CentOS 7 and 8
Occasionally you come up with the world's most unbreakable root password for a MySQL 8 installation and you get distracted before you record it somewhere.... and you remain distracted for 3 months.
Then you return to the project where this database was needed and ... whoops! What was that totally awesome password?
Here's how you can reset your root password. This was based on a page that had a similar instructions except none of them worked - lots of errors and incorrect names - like referring to mysql instead of mysqld when stopping the service.
Here we go:
All as root user:
Create a file in /var/lib/mysql called mysql-pwd with the following contents:
Shutdown mysql
Run MySQL executing the given init file under the mysql user
Check the MySQL log to make sure no errors occurred:
Stop the mysqld that was started directly by first finding its PROCESSID:
Stop it:
Start up mysql the normal systemd way:
Log in using the password contained in the mysql-pwd file
You should now be logged in as root user
Edit the mysql-pwd file to remove the password value so that root password is not available to people viewing that file.
Create a file in /var/lib/mysql called mysql-pwd with the following contents:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'anotherPwd28^$94';
Shutdown mysql
systemctl stop mysqld
Run MySQL executing the given init file under the mysql user
mysqld --init-file=/var/lib/mysql/mysql-pwd --user=mysql &
Check the MySQL log to make sure no errors occurred:
vi /var/log/mysqld.log
Stop the mysqld that was started directly by first finding its PROCESSID:
ps -efa | grep mysqld
Stop it:
kill PROCESSID
Start up mysql the normal systemd way:
systemctl start mysqld
Log in using the password contained in the mysql-pwd file
mysql -u root -p
You should now be logged in as root user
Edit the mysql-pwd file to remove the password value so that root password is not available to people viewing that file.
caehorWpunc_be1984 Robert Singh https://wakelet.com/wake/Ti_TQGCCNT9ySt-1Hci6n
ReplyDeletetractimorrne
consbibZre-ge_Lafayette Annette Daigle https://www.jcicanada.com/profile/Portable-DreaMule-3-2/profile
ReplyDeleteramilosa
Nterplanca-ho Dale Smith download
ReplyDeleteclick here
link
download
raponasubs
grumattezo Leslie Holloway Avast Cleanup
ReplyDeleteCCleaner pro
Affinity Designer
afininhar
sumplatlen-ta Donald Robinson Download
ReplyDeleteLink
uneninel