MySQL Forums
Forum List  »  Router & Proxy

mysql-proxy for a remote MySQL server
Posted by: Erel Segal
Date: November 22, 2011 06:20AM

My program works with a remote MySQL server, and I want to create a local proxy server on my computer in order to make things faster (pool connections, cache queries etc.). I went by the documentation: http://dev.mysql.com/doc/refman/5.1/en/mysql-proxy.html

I ran, on one console:

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

And on another console:

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;

However, instead of seeing the databases on the remote server (qa-srv) I saw the databases on my local server!

I also tried this:

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

I also tried running the proxy instead of the mysql 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

And on another console:

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?

Options: ReplyQuote


Subject
Views
Written By
Posted
mysql-proxy for a remote MySQL server
63014
November 22, 2011 06:20AM
2609
November 22, 2011 10:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.