Last active
November 24, 2022 07:12
-
-
Save mehdi89/4d5d733f3106744960130b9098d1bbb3 to your computer and use it in GitHub Desktop.
How to set mysql root password after install mysql-server in Ubuntu 22.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For DEV Server | |
sudo systemctl stop mysql.service | |
sudo systemctl status mysql.service | |
sudo systemctl set-environment MYSQLD_OPTS="--skip-networking --skip-grant-tables" | |
sudo systemctl start mysql.service | |
sudo systemctl status mysql.service | |
sudo mysql -u root | |
flush privileges; | |
USE mysql | |
ALTER USER 'root'@'%' IDENTIFIED BY 'new_password'; | |
# ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123'; | |
quit; | |
sudo systemctl unset-environment MYSQLD_OPTS | |
sudo systemctl revert mysql | |
sudo killall -u mysql | |
sudo systemctl restart mysql.service | |
sudo mysql -u root -p | |
# https://linuxhint.com/change-mysql-password-ubuntu-22-04/#:~:text=To%20change%20the%20MySQL%20root%20password%20in%20Ubuntu%2022.04%2C%20firstly,to%20specify%20the%20new%20password. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment