安装MySQL:
1. sudo apt-get install mysql-server
2. sudo apt-get install mysql-client
3. sudo apt-get install libmysqlclient-dev
创建用户并授权:
grant all privileges on database_name.table_name to user_name@host identified by 'user_password'; # table_name(*, 所有表),host(%, 所有地址)
flush privileges; # 刷新权限
开启远程访问:
vim /etc/mysql/my.cnf
将bind-address = 127.0.0.1注释,保存退出
service mysql restart 重启mysql