Skip to content

Instantly share code, notes, and snippets.

@diki-haryadi
Created September 20, 2021 08:22
Show Gist options
  • Save diki-haryadi/598eed190d19728e6cc7574327446c76 to your computer and use it in GitHub Desktop.
Save diki-haryadi/598eed190d19728e6cc7574327446c76 to your computer and use it in GitHub Desktop.
Change Password mysql After installation

$ sudo cat /etc/mysql/debian.cnf

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = JRptVM1k9l8SvIau
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = JRptVM1k9l8SvIau
socket   = /var/run/mysqld/mysqld.sock

$ mysql -u debian-sys-maint -p mysql> SELECT User, Host, plugin FROM mysql.user;

mysql> UPDATE mysql.user SET plugin = 'mysql_native_password'; mysql> FLUSH PRIVILEGES;

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'P@ssw0rd'; mysql> FLUSH PRIVILEGES;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment