MySql 默认关闭预编译,批处理
sql 在MySql中的执行过程:
1,校验sql语句的合法性
2 ,将sql语句编译成一个函数
3,执行该函数。
打开预编译之后,再次执行时就可以不用校验和编译,直接执行传递过来的参数
打开预编译:
useServerPrepStmts=true;
cachePrepStmts=true;
1,PreparedStatement 中有集合可进行批处理
2,循环设置参数 添加进集合 addBatch()
3 , 执行批处理方法 executeBatch()
打开批处理:
rewriteBatchedStatements=true;
使用ssl传输
useSSL=true
my.ini
MySQL中my.ini的位置 C:\ProgramData\MySQL\MySQL Server 5.7
MySql 存储多媒体数据时需要在my.ini 中修改max_allowed_packet=80M