Heim  >  Artikel  >  Datenbank  >  让MySQL远程用户访问的方法

让MySQL远程用户访问的方法

WBOY
WBOYOriginal
2016-06-07 17:11:40748Durchsuche

让MySQL远程用户访问的方法(Ubuntu系统下试验成功)1. 用root用户登录后直接进行如下两步操作(注:其中[password]要填写你root用

让MySQL远程用户访问的方法(Ubuntu系统下试验成功)

1. 用root用户登录后直接进行如下两步操作(注:其中[password]要填写你root用户的真实密码):

1.1 use mysql;

1.2 GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY '[password]' WITH GRANT OPTION

2. 在Ubuntu系统下应该在"/etc/mysql/my.cnf"路径下可以找到my.cnf配置文件,用sudo emacs或sudo vi超级权限打开它,找到里面有如下内容的行:

bind-address = 127.0.0.1

把bind-address = 127.0.0.1修改成你本机的IP地址,例如,,我在一个局域网的IP是192.168.1.93,那么就改成:

bind-address = 192.168.1.93

3. 最后一步,需要重启你的mysql,在ubuntu下在命令行下执行"sudo /etc/ini.d/mysql restart"即可,发现成功关闭并重启了就表明OK了,如果发现启动不了了,可能是你改第二步的my.cnf文件时不小心出错,可能是你误多添加了一个bind-address或者打错单词了。bind-address口能修改原来的,只有一个,不能有多个。

linux

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn