1.登录EC2
ssh -i /Users/yangxianyu/Downloads/sshmy.pem ubuntu@公有ip
sudo su 切换root权限
2.安装mysql
安装mysql命令:
sudo apt-get install mysql-server
安装好后会提示设置root用户密码
然后修改my.cnf可以远程访问mysql
vim /etc/mysql/my.cnf
bind-address = 127.0.0.1 改成 bind-address = 0.0.0.0
重启/etc/init.d/mysql restart