Java写入MySQL 主键已存在,则忽略,不存在则插入 1 2 3 INSERT INTO `global_config`(`id`,`name`,`description`,`value`,`status`) SELECT 3,"order_auto_cancel_time","订单超时自动取消时间:分钟","20",1 WHERE NOT EXISTS(SELECT * FROM global_config WHERE `name` = 'order_auto_cancel_time'); 导入导出 导出指定的表 1 mysqldump -uroot -p -t fdb --tables t_role_resource t_interface_resource> /docker-entrypoint-initdb.d/data_table.sql mysql8密码不兼容问题 1 2 3 4 5 docker exec -it mysql bash mysql -uroot -p use mysql ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '12!@QWqw'; flush privileges; 内存溢出 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 前端页面长时间无响应,后台查看error日志发现报错: Out of sort memory, consider increasing server sort buffer size。 字面意思就是 sort内存溢出,考虑增加服务器的排序缓冲区(sort_buffer_size)大小。 进入docker的MySQL服务内: docker exec -it mysql mysql -uroot -p mysql> show variables like '%sort_buffer_size%'; +-------------------------+---------+ | Variable_name | Value | +-------------------------+---------+ | innodb_sort_buffer_size | 1048576 | | myisam_sort_buffer_size | 8388608 | | sort_buffer_size | 262144 | +-------------------------+---------+ 3 rows in set (0.01 sec) 这里的sort_buffer_size=262144 ,262144/1024=256,156k比较小,需要扩大点,到2M(16G内存可以扩这么大) mysql> SET GLOBAL sort_buffer_size = 210241024; Query OK, 0 rows affected (0.00 sec) mysql> exit