• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
开到荼蘼
博客园    首页    新随笔    联系   管理    订阅  订阅
如何设置mysql远程访问

1.查看远程主机mysql服务状态

1 [root@localhost ~]# service mysqld status
2 mysqld is stopped

2.启动远程机mysql服务

如mysql服务未启动, 则先启动mysql服务

[root@localhost ~]# /etc/init.d/mysqld start
Starting MySQL:                                            [  OK  ]

3.进入mysql

[root@localhost ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

4.选择mysql库名

1 mysql> use mysql;
2 Reading table information for completion of table and column names
3 You can turn off this feature to get a quicker startup with -A
4 
5 Database changed
6 mysql> 

5.将mysql库中, root用户的host由localhost改为%

mysql> UPDATE user SET Host='%' WHERE User='root';

6.打开防火墙的3306mysql默认端口, 可参照http://www.cnblogs.com/leaf1117/p/3461952.html              

         
7.重启服务

posted on 2013-12-09 11:03  开到荼蘼  阅读(489)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3