RESET MYSQL ROOT PASSWORD

To reset MySQL root password, you need to stop MySQL services.
$ systemctl stop mysqld
$ systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
$ systemctl start mysqld
$ mysql -u root
mysql> update user set authentication_string=PASSWORD("MyR00tPass") where User='root';
mysql> flush privileges;
mysql> exit
or for MySQL Version 8 
$ sudo mysqld_safe --skip-grant-tables --skip-networking &
$ mysql -u root -p 
mysql> update user set authentication_string=NULL where User='root';
mysql> exit
$ kill -9 mysqld
$ mysql -u root -p
Enter password: [ENTER]
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'MyR00tPass';
mysql> flush privileges;
mysql> exit
$ systemctl restart mysqld
$ mysql -u root -p 
Enter password: [PASSWORD]
mysql>
The root password has been updated. Please try to connect with an updated password
$ mysql -u root -p
mysql> create user 'bss'@'%' identified by 'passw0rd';
mysql> grant all on opensips.* to 'bss'@'%';
mysql> flush privileges;
mysql> exit
enjoy ;)

No comments:

Post a Comment

SIPp UAC Scenario to send RTP

Please install the latest sipp ( >=3.7.3 ) wget https://github.com/SIPp/sipp/releases/download/v3.7.3/sipp chmor +x sipp mv sipp /usr/bin...