开启Mysql远程访问

Mysql默认是不可以通过远程机器访问的,通过下面的配置可以开启远程访问.
我的Mysql环境是ubuntu+mysql5
1.修改/etc/mysql/my.cnf,修改bind-address,指定为本机实际IP地址,你的my.cnf修改完大概是如下的样子

[mysqld]
#
# * Basic Settings
#
default-character-set=utf8
default-storage-engine=INNODB
bind-address    = 192.168.1.107 
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
language        = /usr/share/mysql/english
skip-external-locking

2.用root登陆mysql执行如下命令
grant all on db.* to onelong@’%’  identified by ’123456′; //连接mysql服务器的客户端ip, %=all
grant all on db.* to onelong@localhost  identified by ’123456′;
db替换为你想访问的数据库名, onelong是你的想使用的用户名, e.g., root,123456替换为你的密码,这样就开启了远程访问功能.

Debian / Ubuntu Linux 启动/停止/重启服务
1.启动:/etc/init.d/mysql start
2.停止:/etc/init.d/mysql stop
3.重启:/etc/init.d/mysql restart

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: