如何使本地的mySQL数据库可从不同的机器访问? [英] How to make mySQL database at my local accessible from different machines?
问题描述
我在使用mySQL查询浏览器进行连接的Windows系统上安装了mySQL.我正在接受培训,我希望人们能够连接到我的机器SQL数据库
I have mySQL installed at my Windows system which I connect using mySQL Query Browser. I am giving training and I want people to be able to connect to my machines SQL Database
我该怎么做?当前它不允许连接.
How do I do that? Currently its not allowing the connections.
我需要修改哪些设置?
推荐答案
步骤1:检查IP连接
默认情况下,它仅允许来自127.0.0.1的连接. 您使用的是Windows还是Linux?
By default it only allows connections from 127.0.0.1. Are you using windows or linux?
打开 my.cnf 并将绑定地址更改为您的网络IP.
Open my.cnf and change bind address to your network IP.
[mysqld]
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
bind-address = 127.0.0.1
更多信息可以在Google中轻松找到.选中此.
More info can easily be found in google. Check this.
步骤2:检查防火墙
此外,正如 @Leandro 所评论的那样,请检查Windows防火墙设置以允许建立连接.
Also, as commented by @Leandro, check your windows firewall settings to allow connections to happen.
一种简单的测试方法是从客户端计算机到您的MySQL网络IP(端口3306)建立telnet,然后查看是否连接或被阻塞.
One easy way to test it is to make a telnet from the client machine to your MySQL network ip, port 3306 and see if connects or get blocked.
步骤3:检查mysql用户权限
一旦建立了IP连接,您的校友正在使用的用户应具有来自任何主机的登录权限.例如,如果他们使用root用户,则必须运行如下查询:
Once you have IP connectivity, the user that your alumni are using should have log in permissions from any host. For example if they use root you have to run a query like this:
update user set host=’%’ where user=’root’ and host=’ubuntuserv’;
您可以在此处看到更多信息.
You can see more info here.
这篇关于如何使本地的mySQL数据库可从不同的机器访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!