ubuntu 18.04.1安装mysql8

发布时间 2023-06-29 21:10:02作者: chendaleiQ
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