配置
#server.yaml
rules:
- !AUTHORITY
users:
- root@%:root
- sharding@:sharding
provider:
type: SCHEMA_PRIVILEGES_PERMITTED
props:
user-schema-mappings: root@=test_encrypt_db #数据源未配置test_encrypt_db,mysql中也不存在该db
#config-encrypt.yaml
schemaName: encrypt_db #数据源定义
dataSources:
ds_0:
url: jdbc:mysql://127.0.0.1:3306/test?serverTimezone=UTC&useSSL=false
username: test
password: test
问题点:在config-encrypt.yaml中定义了数据源“encrypt_db”,使用root:root帐号在proxy中看到了 test_encrypt_db 数据源,按正常逻辑,是无法看到任何数据源的。
mysql> show databases;
+-----------------+
| schema_name |
+-----------------+
| test_encrypt_db |
+-----------------+
mysql> use test_encrypt_db
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> SHOW SCHEMA RESOURCES ;
+------+-------+-----------+------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
| name | type | host | port | db | attribute |
+------+-------+-----------+------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
| ds_0 | MySQL | 127.0.0.1 | 3306 | test | {"maxLifetimeMilliseconds":1800000,"readOnly":false,"minPoolSize":1,"idleTimeoutMilliseconds":60000,"maxPoolSize":50,"connectionTimeoutMilliseconds":30000} |
+------+-------+-----------+------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.05 sec)