安装MySQL 8.0

MySQL 5 & 8

remote server

bind-address=0.0.0.0

utf8

[MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3,
but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
  • mysql5
character-set-server=utf8
  • mysql8
character-set-server=utf8mb4

validate password

注意: mysql8.0.4, 我们将无法直接使用phpMyAdmin来登录!

使用phpMyAdmin需要设置MySQL5.7兼容模式:

authentication_policy=mysql_native_password,,
  • mysql5
mysql_native_password
  • mysql8
caching_sha2_password

Ubuntu

install mysql8:

sudo apt install mysql-server
sudo systemctl start mysql.service

config mysql secure

sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'xbfirst80';
sudo mysql_secure_installation

add user

password rule:

SHOW VARIABLES LIKE 'validate_password%';

DBA:

CREATE USER 'DBAdmin'@'localhost'' IDENTIFIED BY 'xb80first';
GRANT ALL PRIVILEGES ON *.* TO 'DBAdmin'@'localhost'' WITH GRANT OPTION;
flush privileges;

remote user:

CREATE USER 'tdtc2022'@'%' IDENTIFIED BY 'qaz1xsw2';
GRANT SELECT,INSERT,UPDATE,DELETE ON carnumber.* TO 'tdtc2022'@'%';
flush privileges;

参考文档