使用Mycat 连接到mysql8 建立表,发现表名,字段名全为大写

边城cn 2021-04-21 08:52:06
问题如标题:

使用Mycat 连接到mySQL8 建立表,发现表名,字段名全为大写
在mycat 的环境下查看表名,是小写的。但在具体datanode 环境下查看表名,字段名是大写
是什么原因导致影响的?怎样配置能达到一致是小写???





也没找到什么参数控制这个,但我在schema 中配置的表名是小写的,
只是schema 是大写。




参数如下:

schema.xml
------------------------------------------------------------------------------------------------------------------

<schema name="ITCAST" checkSQLschema="true" sqlMaxLimit="100">
<!-- auto sharding by id (long) -->
<table name="tb_account" dataNode="dn1,dn2,dn3" rule="auto-sharding-long" />
<table name="tb_user" dataNode="dn1,dn2,dn3" rule="auto-sharding-long" />

</schema>


<dataNode name="dn1" dataHost="localhost1" database="db1" />
<dataNode name="dn2" dataHost="localhost2" database="db1" />
<dataNode name="dn3" dataHost="localhost3" database="db1" />




连接到mycat 中看到表名如下:


mysql> show tables;
+------------------+
| Tables in ITCAST |
+------------------+
| tb_account |
| tb_user |
+------------------+
2 rows in set (0.00 sec)



但在各个具体datanode 库中看到:
[root@mongo ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 52
Server version: 8.0.18 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| db1 |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.01 sec)


mysql> use db1;
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 tables;
+---------------+
| Tables_in_db1 |
+---------------+
| TB_ACCOUNT |
| TB_USER |
+---------------+
2 rows in set (0.01 sec)

mysql> show create table TB_ACCOUNT;
+------------+--------------------------------------+
| Table | Create Table |
+------------+--------------------------------------------------------+
| TB_ACCOUNT | CREATE TABLE `TB_ACCOUNT` (
`ID` int(11) unsigned NOT NULL,
`USER_ID` int(11) NOT NULL DEFAULT '0' COMMENT '用户ID',
`USER_NAME` varchar(30) NOT NULL DEFAULT '' COMMENT '用户名',
`ACCOUNT_ID` varchar(50) DEFAULT NULL COMMENT '银行电子账户/连连合作银行账户',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+------------+------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show create table tb_account ;
ERROR 1146 (42S02): Table 'db1.tb_account' doesn't exist
mysql>




mysql> SHOW VARIABLES LIKE '%case%'
-> ;
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
+------------------------+-------+





-------------------------------建表 SQL ,是在mycat 环境执行SQL的 ------------------------

create table `tb_user` (
`user_id` int(11) unsigned not null,
`user_name` varchar(30) not null default '' comment '用户名',
mobile varchar(50) null default null ,
primary key (user_id)
);
...全文
1036 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_34311750 2022-04-18
  • 打赏
  • 举报
回复

楼主解决了没,我也碰上这个问题了,卡住3天了没办法......

56,678

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧