解决mysql导入新数据库大小写问题(Table 'zup.Domain_System' doesn't exist)
时间:2022-07-22
本文章向大家介绍解决mysql导入新数据库大小写问题(Table 'zup.Domain_System' doesn't exist),主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
问题
Table ‘zup.Domain_System’ doesn’t exist
### The error occurred while setting parameters
### SQL: SELECT * FROM Domain_System WHERE domain = ? LIMIT 1
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'zup.Domain_System' doesn't exist
; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'zup.Domain_System' doesn't exist] with root cause
解决问题
首先可以肯定我数据库中是存在这个表的,只是全是小写的,而SpringBoot项目中的是开头大写字母的
在mysql 5.7.x版本中默认是大小写区分的。
可以登录mysql之后查看show variables like "%case%";
:
lower_case_table_names=0,默认为0,则区分大小写
truedei@truedei:/codeProject$ sudo mysql -h 127.0.0.1 -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.7.29 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)]> show variables like "%case%";
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 0 |
+------------------------+-------+
2 rows in set (0.00 sec)
MySQL [(none)]>
所以解决方法就是修改mysql中的配置文件,让其忽略大小写:
因为我使用的是docker安装的mysql5.7,并且把配置文件映射到 了:/data/mysql/conf/my.conf
修改配置文件my.conf
truedei@truedei:~$
truedei@truedei:~$ sudo vim /data/mysql/conf/my.conf
添加上:
lower_case_table_names=1
保存
我在这里就需要重启docker,你如果是直接安装的mysql,可以直接重新mysql即可
truedei@truedei:~$
truedei@truedei:~$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0a122a08125f mysql:5.7.29 "docker-entrypoint.s…" 2 hours ago Up 4 minutes 0.0.0.0:3306->3306/tcp, 33060/tcp mysql57
truedei@truedei:~$
truedei@truedei:~$
truedei@truedei:~$
truedei@truedei:~$ sudo docker restart mysql57
mysql57
truedei@truedei:~$
可以看到变成了1
truedei@truedei:/codeProject$ sudo mysql -h 127.0.0.1 -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.7.29 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)]>
MySQL [(none)]> show variables like "%case%";
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| lower_case_file_system | OFF |
| lower_case_table_names | 1 |
+------------------------+-------+
2 rows in set (0.00 sec)
MySQL [(none)]>
就可以解决此问题
- Python时间运算的详细机制初探讨
- C++编译错误cannot have cv-qualifier
- Python写TCP端口扫描工具之IP协议的讲解
- mac上nginx+jetty负载均衡部署一览
- Python标准库(1) — itertools模块
- C++从键盘输入文件结束符
- java cpu高达100%问题 排查
- (43) 剖析TreeMap / 计算机程序的思维逻辑
- Spring Cloud第一篇 Eureka简介及原理
- 华为面试题——约瑟夫问题的C++简单实现(循环链表)
- (49) 剖析LinkedHashMap / 计算机程序的思维逻辑
- Python多进程并行编程实践-mpi4py的使用
- 华为面试题——一道关于指针方面的编程题(C/C++)
- Spring Cloud第二篇 创建一个Eureka Server
- MySQL 教程
- MySQL 安装
- MySQL 管理与配置
- MySQL PHP 语法
- MySQL 连接
- MySQL 创建数据库
- MySQL 删除数据库
- MySQL 选择数据库
- MySQL 数据类型
- MySQL 创建数据表
- MySQL 删除数据表
- MySQL 插入数据
- MySQL 查询数据
- MySQL where 子句
- MySQL UPDATE 查询
- MySQL DELETE 语句
- MySQL LIKE 子句
- mysql order by
- Mysql Join的使用
- MySQL NULL 值处理
- MySQL 正则表达式
- MySQL 事务
- MySQL ALTER命令
- MySQL 索引
- MySQL 临时表
- MySQL 复制表
- 查看MySQL 元数据
- MySQL 序列 AUTO_INCREMENT
- MySQL 处理重复数据
- MySQL 及 SQL 注入
- MySQL 导出数据
- MySQL 导入数据
- MYSQL 函数大全
- MySQL Group By 实例讲解
- MySQL Max()函数实例讲解
- mysql count函数实例
- MYSQL UNION和UNION ALL实例
- MySQL IN 用法
- MySQL between and 实例讲解