解决思路:针对神情插入的问题,必定照样字符集的问题。
处理办法:我们可以直接在参数文件中,参加:
- vim /etc/my.cnf
- [mysqld]
- init-connect='SET NAMES utf8mb4'
- character-set-server=utf8mb4
注:utf8mb4 是 utf8 的超集。
案例八
应用 binlog_format=statement 这种格局,跨库操作,导致大年夜库损掉数据,用户拜访导致出现缺点数据信息
当前数据库二进制日记的格局为:binlog_format=statement
在主库设置 binlog-do-db=mydb1(只同步mydb1章一?库)。
在主库履行 use mydb2;
insert into mydb1.t1 values (‘bb’);这条语句不会同步到大年夜库。
use mydb1;
insert into mydb1.t1 values (‘bb’);因为这是在同一个库中完成的操作。
在临盆情况中建议应用binlog的格局为row,并且慎用 binlog-do-db 参数。
处理办法:
- 数据终端,也就是我们连接数据库的对象设置为 utf8。
- 操作体系层面,可以经由过程 cat /etc/sysconfig/i18n 查看,也要设置为 utf8。
- 数据库层面,在参数文件中的 mysqld 下,参加 character-set-server=utf8。
案例九
MySQL 数据库连接超时的报错
- org.hibernate.util.JDBCExceptionReporter - SQL Error:0, SQLState: 08S01
- org.hibernate.util.JDBCExceptionReporter - The last packet successfully received from the server was43200 milliseconds ago.The last packet sent successfully to the server was 43200 milliseconds ago, which is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection 'autoReconnect=true'
推荐阅读
云原生工作负载和容器本质上是不合的。人们须要懂得若何保持安然,起重要懂得赓续变更的威逼性质。那么哪个更安然:虚拟机(VM)照样容器?事实是,确保容器和云原生工作负载的安然与虚拟机不>>>详细阅读
本文标题:MySQL数据库的“十宗罪”(附10大经典错误案例)
地址:http://www.17bianji.com/lsqh/37079.html
1/2 1