sudo apt-get update #更新源 sudo apt-get install mysql-server #安装 create user 'root'@'%' identified by '123456'; grant all privileges on *.* to 'root'@'%'; alter user 'root'@'localhost' identified with mysql_native_password by '123456'; flush privileges; create database swtest; create user 'swadmin'@'%' identified by 'p@ssw0rd@sw'; grant all privileges on *.* to 'swadmin'@'%' with grant option; flush privileges; alter user 'root'@'%' identified with mysql_native_password by '123456';
安装说明: mysqld install MySQL3303 --defaults-file="C:\Program Files\MySQL\8.0.18\MySQL3303.ini" mysqld install MySQL3306 --defaults-file="C:\Program Files\MySQL\8.0.18\MySQL3306.ini" mysqld --defaults-file="C:\Program Files\MySQL\8.0.18\MySQL3303.ini" --initialize --console mysqld --defaults-file="C:\Program Files\MySQL\8.0.18\MySQL3306.ini" --initialize --console net start MySQL3303 net start MySQL3306 mysql -P3303 -uroot -p 输入原始密码 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; flush privileges; use mysql; select host, user, plugin from user; mysql -P3306 -uroot -p 输入原始密码 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; flush privileges; use mysql; select host, user, plugin from user; 卸载说明: mysqld -nt -remove "MySQL3303" net stop "MySQL3303" sc delete MySQL3303