安装Mysql并配置
$ sudo apt-get install mysql-server # 查看是否运行$ ps aux | grep mysql
接下来配置mysql的密码和权限问题
sudo mysql_secure_installation
1.是否安装密码校验插件VALIDATE PASSWORD PLUGIN can be used to test passwords......选择n
2.设置密码Please set the password for root here.New password:xxxxxxRe-enter new password:xxxxxx
3.删除匿名用户(生产环境有必要删除)By default, a MySQL installation has an anonymous user......选择y
4.是否允许root用户远程登录Normally, root should only be allowed to connect from‘localhost'. ......选择y
5.是否删除“测试”库By default, MySQL comes with a database named ‘test' thatanyone can access. This is also intended only for testing,......选择y
6.是否立即生效Reloading the privilege tables will ensure that all changes......选择y
配置完mysql后,把bind-address注释掉,使得本机以外的ip都能连接进来:
$ sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf# 把这一行注释上 # bind-address 127.0.0.1 # 保存退出!wq