一.云主机安装MySQL
1.更新源
可做可不做。
sudo apt update
2.安装MySQL
没啥好说的,正常安装。
sudo apt install mysql-server
3.登录
进入数据设置root账户的密码和权限
sudo mysql
注:以下mysql的命令都带分号(;)
i)切换mysql数据库
use mysql;
ii)修改root用户密码
update user set plugin='mysql_native_password' where user='root';
update user set authentication_string=PASSWORD('密码') where user='root';
‘密码’填自己的密码。
4.设置登录权限
设置root账号允许远程登录,默认只允许本地登录。
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
命令说明<