Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShardingSphere-Proxy 5.0.0 return 'No database selected' #11712

Closed
cqiwencom opened this issue Aug 9, 2021 · 4 comments
Closed

ShardingSphere-Proxy 5.0.0 return 'No database selected' #11712

cqiwencom opened this issue Aug 9, 2021 · 4 comments

Comments

@cqiwencom
Copy link

When i connect to shardingsphere-proxy:
mysql -uroot -proot -P3307 -h127.0.0.1
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 65
Server version: 5.7.33-log-ShardingSphere-Proxy 5.0.0-beta

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)]> select id,name,@@PORT from testdb.t1;
ERROR 1046 (3D000): No database selected
MySQL [(none)]> use testdb;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MySQL [testdb]> use testdb;
Database changed
MySQL [testdb]> select id,name,@@PORT from testdb.t1;
+----+--------+--------+
| id | name | @@PORT |
+----+--------+--------+
| 1 | mm | 3318 |
| 2 | gg | 3318 |
| 3 | niuniu | 3318 |
| 4 | hhhh | 3318 |
| 5 | DBR920 | 3318 |
| 6 | 3316 | 3318 |
+----+--------+--------+
6 rows in set (0.01 sec)

But when I connect directly to the back-end database:

mysql -uroot -proot -P3316 -h127.0.0.1

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 512125
Server version: 5.7.33-log MySQL Community Server (GPL)

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)]> select * from testdb.t1;
+----+--------+
| id | name |
+----+--------+
| 1 | mm |
| 2 | gg |
| 3 | niuniu |
| 4 | hhhh |
| 5 | DBR920 |
| 6 | 3316 |
+----+--------+
6 rows in set (0.00 sec)

I don't need use database! Is there any way for shardingsphere-proxy to realize this function?

@strongduanmu
Copy link
Member

Hi @cqiwencom, thank you for your feedback, and we have implemented this feature in the master branch, and welcome to test.

@tristaZero
Copy link
Contributor

@cqiwencom Hi could you have a try?

@taojintianxia
Copy link
Contributor

taojintianxia commented Aug 18, 2021

hi there, today someone from the community ask the same issue. so I try the up to date cocde (code pulled in 2021-08-18), and the no database selected issue still exist

Navicat MySQL 12

image

@RaigorJiang
Copy link
Contributor

Fixed in #11994

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants