[question RE: proxy example] unable to select database
See original GitHub issueHi. Great library!
The following output is produced by a proxy server which uses your wonderful library as both a server and a client (to a remote MariaDB database).
This test fully confirms that the observed behavior isn’t the result of anything that I added, since the same occurs in the proxy server example as taken directly from your repo.
Example from the mysql
command-line client connected to the proxy:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: mysql-proxy mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| mysql_proxy_test |
| performance_schema |
| test |
+--------------------+
5 rows in set (0.005 sec)
MySQL [(none)]> use mysql_proxy_test;
Database changed
MySQL [mysql_proxy_test]> select database();
+------------+
| database() |
+------------+
| NULL |
+------------+
1 row in set (0.014 sec)
MySQL [mysql_proxy_test]> show tables;
ERROR 1064 (_____): No database selected
MySQL [mysql_proxy_test]>
The fundamental issue is how the mysql
client executes “USE db_name;” statements. Apparently, this command isn’t sent to the proxy and, consequently, is not forwarded to the remote db connection. Instead, this connection sees: “SELECT DATABASE()”.
I can fully confirm that when the “USE db_name;” query is directly passed to the remote db connection… it works. The problem is that the mysql
client doesn’t communicate this query.
Do you think this is a bug in the mysql
client?
Issue Analytics
- State:
- Created 4 years ago
- Comments:22 (22 by maintainers)
not a problem… my project is just a proof-of-concept for right now… nothing mission critical. I’ll try to write a monkey patch for until it hits npm.
awesome!
after applying that fix… I retested:
…and now “USE db_name;” statements work in the
mysql
client