English 中文(简体)
遥远的MySQL服务器
原标题:mysql-proxy for a remote MySQL server

我的方案与一个遥远的MySQL服务器合作,我希望在我的计算机上建立一个当地代理服务器,以便更快地做事(联通、问答等)。 我拿到文件:

I:

erelsgl@ubuntu:~$ mysql-proxy --proxy-backend-addresses=$MYSQL --log-level=debug2011-11-22 09:43:30: (message) mysql-proxy 0.8.2 started
2011-11-22 09:43:30: (debug) max open file-descriptors = 1024
2011-11-22 09:43:30: (message) proxy listening on port :4040
2011-11-22 09:43:30: (message) added read/write backend: qa-srv:3308

另一座圣殿:

erelsgl@ubuntu:~$ mysql --user root --host=localhost --port=4040
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 81
Server version: 5.1.41-3ubuntu12.10 (Ubuntu)

Type  help;  or  h  for help. Type  c  to clear the current input statement.

mysql> show databases;

然而,我不见边远服务器数据库(qa-srv),就看到我当地服务器的数据库!

我也试图这样做:

erelsgl@ubuntu:~$ mysql --user root --host=qa-srv --port=4040
ERROR 2003 (HY000): Can t connect to MySQL server on  qa-srv  (111)

我还试图管理代理,而不是我方ql daemon:

erelsgl@ubuntu:~$ sudo service mysql stop
mysql stop/waiting
erelsgl@ubuntu:~$ mysql-proxy --proxy-backend-addresses=$MYSQL --log-level=debug --proxy-address=0.0.0.0:3306
2011-11-22 14:14:25: (message) mysql-proxy 0.8.2 started
2011-11-22 14:14:25: (debug) max open file-descriptors = 1024
2011-11-22 14:14:25: (message) proxy listening on port 0.0.0.0:3306
2011-11-22 14:14:25: (message) added read/write backend: qa-srv:3308

另一座圣殿:

erelsgl@ubuntu:~$ mysql --user root
ERROR 2002 (HY000): Can t connect to local MySQL server through socket  /var/run/mysqld/mysqld.sock  (2)

How can I tell my mysql client to connect to the remote server via the local proxy?

最佳回答

Hurray! I found the solution.

关于A组:

erelsgl@ubuntu:~$ mysql-proxy --proxy-backend-addresses=qa-srv:3308 --log-level=debug --proxy-address=127.0.0.1:3306
2011-11-22 18:55:02: (message) mysql-proxy 0.8.2 started
2011-11-22 18:55:02: (debug) max open file-descriptors = 1024
2011-11-22 18:55:02: (message) proxy listening on port 127.0.0.1:3306
2011-11-22 18:55:02: (message) added read/write backend: qa-srv:3308

B号:

erelsgl@ubuntu:~$ mysql -u <username-on-remote-database> -h 127.0.0.1

Or, alternatively, if you still want your local database active:

关于A组:

erelsgl@ubuntu:~$ mysql-proxy --proxy-backend-addresses=qa-srv:3308 --log-level=debug
2011-11-22 18:55:02: (message) mysql-proxy 0.8.2 started
2011-11-22 18:55:02: (debug) max open file-descriptors = 1024
2011-11-22 18:55:02: (message) proxy listening on port 127.0.0.1:3306
2011-11-22 18:55:02: (message) added read/write backend: qa-srv:3308

B号:

erelsgl@ubuntu:~$ mysql -u <username-on-remote-database> -h 127.0.0.1 -P 4040
问题回答

暂无回答




相关问题
Linking MySQL Workbench to my Remote Server

I ve just downloaded MySQL Workbench. But I don t quite understand how to syn this with the databases on my remote server. Work bench asks for "hostname" so I provided the hostname of my remote ...

mysql proxy r/w replication and temporary tables

I am doing master/slave replication on MySQL5.1 and r/w split with mysql proxy 0.8.x It works fine except with temporary tables. MySQL throws an error, that the temporary table is not existent. This ...

admin-username error of proxy

I tried to install proxy on development machine and I got the following error. /etc/init.d/mysql-proxyd start Starting mysql-proxy: 2011-02-26 15:51:45: (critical) admin-plugin.c:569: --admin-...

Best implementation for MySQL replication with Rails 3?

We re looking at potentially setting up replication for our primary MySQL database, and while setting up the replication seems pretty straight-forward, the application implementation seems a bit ...

Anything similar to MySQL Proxy for PostgreSQL? [closed]

I am looking for something similar to MySQL Proxy. The purpose is to modify incoming queries on the server. I am not looking for alternative ways to achieve the same. My best guess at the moment is to ...

Expiring memcached using mysql proxy when an update occurs?

I have mysql Proxy running which takes a query, performs an md5 on it, and caches the result into a memcached DB. the problem occurs when an update happens in the rails app that would invalidate that ...

热门标签