通过服务器连接到MySQL数据库 [英] Connecting to MySQL Database over server

查看:329
本文介绍了通过服务器连接到MySQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用网络等方面,我是一个初学者,所以在此道歉.不久前,我在计算机上本地建立了一个mySQL数据库,并建立了许多可以使用它的简单程序. (又名root:localhost之类的东西).

I'm quite a beginner when it comes to working with networks and the like, so apologizes up front. A while back I set up a mySQL database locally on my machine, and have built a number of simple programs that work with it. (aka root:localhost sort of thing).

很好,但是我现在希望允许我工作中的其他同事从他们的计算机访问数据库,但是我不知道如何.

This has been great, but I'm now hoping to allow other colleagues at my work to access the database from their machines, but I have no idea how.

可能会有一些网络保护问题(防火墙等),因此可能需要考虑...(尽管我在这方面得到了IT的帮助,但IT或我本人都不知道连接"需要什么)到数据库).

Likely there will be some network protection issues (firewalls etc), so that may need to be taken into account... (although I have IT's help on this, neither IT or myself really know what is required to 'connect' to the database).

例如,这仅仅是我需要的IP吗?我是否需要更改数据库的设置?我知道本地主机无法在我的同事的计算机上运行,​​因为显而易见的原因,我不知道其他人可以使用它来代替它.

For example, is it just an IP I need? Do I have to change the setup of my database? I understand that localhost would not work from my colleagues computer's, for obvious reasons, I have no idea what would go in its place for others to access it.

我也不介意将我的机器作为专用数据库机器运行...我将无法在我的机器之外的专用服务器或类似服务器上运行它.

I also do not mind having my machine run as the dedicated database machine... I would not be able to run it off a dedicated server or anything like that, beyond my machine.

任何帮助将不胜感激! 谢谢.

Any help would be much appreciated! Thanks.

推荐答案

首先,您的同事需要的是:

First of all, what your colleagues need are:

  • MySQL服务器所在的IP地址 跑步.
  • 用于远程连接的用户和密码
  • 在网络上打开端口3306
  • MySQL客户端(mysql工作台,mysql查询浏览器,toad,heidi或仅命令行工具).
  • The IP Address where MySQL server is running.
  • User and Password to connect remotely
  • Have the port 3306 open on the network
  • A MySQL Client (mysql workbench, mysql query browser, toad, heidi or just the Command Line tool).

在MySQL中创建用户时,必须是这样的:

When you create user in MySQL the have to be something like this:

'root'@'localhost'

这意味着,如果您使用用户root从localhost连接,则该用户将工作.因此,您可以创建允许从任何地方进行连接的用户:

That means, the user will work if you connect from localhost with the user root. So you can create user allowed to connect from anywhere:

'juanperez'@'%'

最后,您要谨慎对待授予他们的特权.不要忘记在MySQL的选项文件中注释"bind-address"(该选项可防止远程连接)的行.

And finally you have be careful about what privileges are you granting to them. Do not forget to comment a line in the options file of the MySQL that says "bind-address" (this options prevents remote connection).

这篇关于通过服务器连接到MySQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆