将MySQL Workbench链接到我的远程服务器 [英] Linking MySQL Workbench to my Remote Server

查看:291
本文介绍了将MySQL Workbench链接到我的远程服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚下载了MySQL Workbench.

I've just downloaded MySQL Workbench.

但是我不太了解如何将其与远程服务器上的数据库进行同步.

But I don't quite understand how to syn this with the databases on my remote server.

工作台要求输入主机名",因此我提供了远程服务器的主机名.我指定端口3306.

Work bench asks for "hostname" so I provided the hostname of my remote server. I designate port 3306.

然后我提供一个用户名.这是我登录PhpAdmin时使用的用户名-我应该使用其他用户名吗?

I then provide a username. This is the username I use when I log into PhpAdmin -- should I be using a different one?

然后,我提供一个密码,再次与用于PhpAdmin的密码相同.

Then I provide a password, again the same one I use for PhpAdmin.

但这是行不通的.

奇怪的是,错误总是告诉我我的用户名是:username@current_network_im_using_to_access_the_internet

Oddly, the error always tells me my user name is: username@current_network_im_using_to_access_the_internet

但是,这似乎不正确-在phpAdmin上,我的用户名是username@localhost.

But this doesn't seem right -- on phpAdmin my user name says username@localhost.

我不太确定该怎么办.

你能帮我吗?

推荐答案

MySQL将登录视为特定于它们所源自的主机.您的家用计算机密码可以与服务器本身使用的密码不同,并且可以从不同的原始主机为同一用户名授予完全不同的权限集.

MySQL treats logins as specific to the host they originate from. You can have a different password from your home machine than the one you use on the server itself, and you can have entirely different sets of permissions granted to the same username from different origin hosts.

在PHPMyadmin上,数据库与Web服务器在同一服务器上运行,因此将其自身称为IP为127.0.0.1localhost.安装了Workbench的计算机必须使用与username@localhost不同的凭据访问MySQL.服务器要求您授予您打算从其连接的任何主机对用户名的访问权限.

On PHPMyadmin, the database is running on the same server as the web server, and therefore refers to itself as localhost, with IP 127.0.0.1. Your machine on which Workbench is installed must access MySQL with different credentials than your username@localhost. The server requires you to grant access to your username from any host you intend to connect from.

在PhpMyAdmin中,您将需要从远程主机授予对数据库的访问权限:(有关如何允许来自 any 主机的连接的信息,另请参见Pekka的答案)

In PhpMyAdmin, you will need to grant access to your database from the remote host: (See also Pekka's answer for how to allow connections from any host)

GRANT ALL PRIVILEGES on dbname.* TO yourusername@your_remote_hostname IDENTIFIED BY 'yourpassword';

要查看您当前在localhost上拥有的所有补助金,以便可以将其复制到远程主机:

To see all the grants you currently have on localhost so that you can duplicate them for the remote host:

SHOW GRANTS FOR yourusername@localhost;

此外,首先需要将MySQL服务器设置为接受远程连接.并非总是如此,尤其是在虚拟主机平台上.在my.cnf文件中,必须删除skip-networking行或将其注释掉.如果没有skip-networking行,则必须注释掉该行:

Additionally, the MySQL server needs to be setup to accept remote connections in the first place. This isn't always the case, especially on web hosting platforms. In the my.cnf file, the skip-networking line has to be removed or commented out. If there is no skip-networking line, you must comment out the line:

bind-address = 127.0.0.1 

...然后重新启动MySQL.

...then restart MySQL.

这篇关于将MySQL Workbench链接到我的远程服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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