sudo apt update
sudo apt install mysql-server
sudo systemctl status mysql
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
create user 'testuser'@'host' identified by 'password';
exit
mysql -u root -p
use mysql;
update user set host='%' where user='testuser';
GRANT ALL PRIVILEGES ON *.* TO 'testuser'@'%' WITH GRANT OPTION;
alter user 'testuser identified with mysql_native_password by 'password';
FLUSH PRIVILEGES;
exit
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
设置bind-address为0.0.0.0
sudo systemctl restart mysql
标签:testuser,18.04,mysql8,PRIVILEGES,sudo,user,mysql,password,ubuntu
From: https://www.cnblogs.com/chendaleiQQ/p/17515218.html