linminqin 2012-03-27
1. 安装 mysql : sudo apt-get install mysql-server
2. 打开linux 3306 端口
sudo netstat -an|grep 3306
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
vi /etc/mysql/my.cnf
# bind-address = 127.0.0.1 注释
bind-address = 192.168.1.210
3. 打开远程访问mysql服务器
授权法:
grant all privileges on *.* to 'root'@'192.168.1.210' identified by 'hadoop';
Query OK, 0 rows affected (0.02 sec)
改表法:
mysql -u root -pvmwaremysql>use mysql;
mysql>update user set host = '%' where user = 'root';
mysql>select host, user from user;
4. 重启 mysql
sudo /etc/init.d/mysql restart
Reference:
Linux下如何启用MySQL数据库远程访问
Ubuntu Linux中开启MySQL远程访问功能
linux下 解决MySQL不允许从远程访问的方法