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

Could not create table after logic database created for MySQL #34816

Open
menghaoranss opened this issue Feb 28, 2025 · 1 comment
Open

Could not create table after logic database created for MySQL #34816

menghaoranss opened this issue Feb 28, 2025 · 1 comment

Comments

@menghaoranss
Copy link
Contributor

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

master

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-Proxy For MySQL

Expected behavior

create table successfully

Actual behavior

create table failed

Reason analyze (If you can)

The default schema was not created after logic database created.

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

mysql> create database test_db;
Query OK, 0 rows affected (0.06 sec)

mysql> use test_db;
Database changed
mysql> 
mysql> 
mysql> REGISTER STORAGE UNIT ds_0 (
    ->         URL="jdbc:mysql://127.0.0.1:3306/pipeline_it_3?rewriteBatchedStatements=true&useServerPrepStmts=true&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC&characterEncoding=utf-8&useLocalSessionState=true",
    ->         USER="root",
    ->         PASSWORD="123456",
    ->         PROPERTIES("maximumPoolSize"="50","idleTimeout"="30000")
    ->         );
Query OK, 0 rows affected (3.46 sec)

mysql> load single table *.*;
Query OK, 0 rows affected (3.24 sec)

mysql> show tables;
Empty set (0.01 sec)

mysql> create table test_1(id int not null);
ERROR 10001 (42S02): Schema 'test_db' does not exist.
mysql> create table test_1(id int not null);
ERROR 2013 (HY000): Lost connection to MySQL server during query
No connection. Trying to reconnect...
Connection id:    1
Current database: test_db

ERROR 10001 (42S02): Schema 'test_db' does not exist.

Example codes for reproduce this issue (such as a github link).

@linghengqian
Copy link
Member

linghengqian commented Feb 28, 2025

org.apache.shardingsphere.test.natived.proxy.transactions.base.SeataTest
org.apache.shardingsphere.test.natived.proxy.databases.PostgresTest
org.apache.shardingsphere.test.natived.proxy.databases.MySQLTest
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   MySQLTest.assertShardingInLocalTransactions:140->initEnvironment:146 » SQLSyntaxError Schema 'sharding_db' does not exist.
[ERROR]   PostgresTest.assertShardingInLocalTransactions:140->initEnvironment:146 » PSQL ERROR: Schema 'public' does not exist.
[ERROR]   SeataTest.assertShardingInLocalTransactions:166->initEnvironment:172 » PSQL ERROR: Schema 'public' does not exist.
[INFO] 
[ERROR] Tests run: 23, Failures: 0, Errors: 3, Skipped: 0
[INFO] 

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

2 participants