---
title: "ubuntu mysql 远程 访问"
author: "mlzboy"
date: "2010-12-10T16:03:00Z"
tags: []
slug: "ubuntu-mysql"
draft: false
lastmod: "2010-12-10T16:03:00Z"
id: 839252
url: "https://lexus.iteye.com/blog/839252"
---

#### [mysql](http://xiaofeng1982.blog.163.com/blog/#m=0&t=1&c=fks_087070084085088065085083087095087087084068086082083075 "mysql") 2010-10-27 01:08:33 阅读40 评论0   字号：大中小 [订阅]() 在Ubuntu下MySQL缺省是只允许本地访问的，如果你要其他机器也能远程够访问这台Mysql数据库的话，需要设置一些东西，下面我们一步步地来： 一、配置文件的修改     1.#sudo vim /etc/mysql/my.conf     找到 bind-address = 127.0.0.1     注释掉这句话   二、Mysql数据库的修改 1) \[root@etc etc]# mysql -u  root  -p Enter password: 2)mysql&gt; use mysql; 3)mysql&gt; select host,user,password from user; 4)grant all privileges on \*.* to  root@192.168.15.101  identified by 'password'  注意： （1）192.168.15.101是欲连接到此Mysql数据库的客户端的IP地址，而不是Mysql数据库所在数据库服务器的IP地址，切记               （2）password就是Mysql数据库root用户的password,根据实际情况需要修改

 

 

 

 

#### 公告：

#### [技术盛宴SD2.0大会隆重开幕,现场图文直播，敬请关注！](http://blog.csdn.net/SD2China/archive/2010/12/09/6064623.aspx) [\[意见反馈\]](http://forum.csdn.net/SList/blogSupport)[\[官方博客\]](http://blog.csdn.net/blogdevteam)

# ![原创](http://blog.csdn.net/images/authorship.gif)  在Ubuntu下使MySQL数据库可以被远程访问 [收藏]()

 在Ubuntu下MySQL缺省是只允许本地访问的，如果你要其他机器也能远程够访问这台Mysql数据库的话，需要设置一些东西，下面我们一步步地来：

一、配置文件的修改  
    1.#sudo vim /etc/mysql/my.conf

    找到 bind-address = 127.0.0.1  
    注释掉这句话   
   
二、Mysql数据库的修改  
1\) \[root@etc etc]# mysql -u  root  -p  
Enter password:   
2)mysql&gt; use mysql;  
3)mysql&gt; select host,user,password from user;  
4)grant all privileges on \*.* to  [root@192.168.15.101](mailto:root@192.168.15.101)  identified by 'password'  
 注意： （1）192.168.15.101是欲连接到此Mysql数据库的客户端的IP地址，而不是Mysql数据库所在数据库服务器的IP地址，切记  
              （2）password就是Mysql数据库root用户的password,根据实际情况需要修改

三、再次用Mysql客户端登陆

 

 

 

 

 

 

 

 

 

 

[独立的MySQL数据库需要做配置才能在外部访问到。](http://www.cnblogs.com/hawkjin/archive/2008/12/04/1347773.html)

1.数据库服务器 my.cnf  
  去掉 #skip-networking,  
  否则为单机模式

2.允许用户通过网络访问的付权   
Grant all privileges on \*.* to 'root'@'10.0.0.1' identified by 'youpassword'