MySQL 安裝後必要步驟

https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-ubuntu-18-04

sudo mysql_secure_installation

SELECT user,authentication_string,plugin,host FROM mysql.user;
ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘$ComplatedPasswords’;
FLUSH PRIVILEGES;

CREATE USER ‘sammy’@’localhost’ IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON *.* TO ‘sammy’@’localhost’ WITH GRANT OPTION;

SHOW VARIABLES LIKE ‘validate_password%’;
SET GLOBAL validate_password_policy=LOW;

Or we can set it in my.cnf file

[mysqld]
validate_password_policy=LOW

my.cnf

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘$ROOTPASSWORD$’;
FLUSH PRIVILEGES;
SELECT user,authentication_string,plugin,host FROM mysql.user;

SHOW VARIABLES LIKE ‘validate_password%’;