1.this is incompatible with sql_mode=only_full_group_by
set @@sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
2.表“TableDetails”中列“IsPrimaryKey”的值为 DBNull
set global optimizer_switch='derived_merge=off';
set optimizer_switch='derived_merge=off';
如果执行到此处仍然无效,重启mysql再次执行即可,多次亲测有效
3.navicat设置外键保存后消失
设置数据库引擎为InnoDB
4.MySQL8.0 Authentication method 'caching_sha2_password' not supported by any of the available plugins.
修改默认的配置文件
C:\ProgramData\MySQL\MySQL Server 8.0\my.ini
default_authentication_plugin=mysql_native_password
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAmYAAAAmCAYAAABu61fPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAzJSURBVHhe7Z3dldu6DoVdlwtyHbcEv6WKeXUBKSIvruCsFOGLzR+JpEiAEqWxPNnfWT4ZiyJAgABI0c7k8t9//71A/JMQQgghhLyHC/7HzRkhhBBCyPvhiRkhhBBCyEngiRkhhBBCyEngiRkhhBBCyEkwT8zuv26vx9/76/r1CFcIIYQQQsgRGCdmj9ft1/31/HN7XX8/wzWb5+/r6/K/S+V1fd3/zu23P6HD4Ygd0C+2rOXxldpy3W/M4tMod41vz8D3z1+bx9d7/fdu/U2+Kb5Oa78Cxhxr0c9ge32rcab8/ul8Yv6Mwviy0U/MwkkZHLnGibg/BhsCL/a9/5qL4VqZ4/hN5ipg/6/b68i0SX1V4k4rw8/vQNP/HfN3Zvs/BS2+zs6R/k9r0c9gQ31T+P76/PM4e/04enyafMaXTvPEzD9VFq8NH2emG7MUNzG/ZeMTZZeT+BeFZtZ9/bqv2yBl/REEReEy5FftT/v/uefyf8+jh224Hu2OsmoLZHXhxIYw6kxeqwJ5ZHwd+kfmL+q/ft3q/XvsN0+EnmKX1+NeMne3d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fY4+PMuP12vxn4xclWz7K3GxfmnfSr7kxCza77zoVsjH+9KNsfBSWLtb5/BzzUWbT/m+IP4+PuUUsCl31T0GNvw77euZHa4c/b/gOHwxDm7s/tAkLmxsfZdZ9Z68fhJA28ohdOTEDYSH2R+FIWnmPn6fkCsnm2nFdCpVkdsxFd0Qe2+IryXwUxHgdBerh3qeLWaIfSS6F1d3rbghjWbzyhdUVo9iWFQqbsfF5WvpT2c4lcl98P/dv+7evf1t/n/9koSj0l0/wsa3qH2FP/dhoxLZe+zXcwuO+kBx0rx2fOf/L9qxtkpm+vPwx+xLZ6Bz6ol+U62RGXHtiVwCbhFs2/3JPphobidge6sNUG3T7LHrsPz7+PE5P5rCIXv8s9Piz7bPmx5w/bP4meU/xR+47XGt/+b/uv8xN5vpBCGnB3/xP/kkWJwIHg4XV3lS9AWxedhkXFmIuur18d/wRQj6H9okZIT+U7DT3wM1EqgenHmdah/FR9eSDxWnJOjJZ3JyZfFf8EUI+E56YEUIIIYSchH/vxMx9tyJ5Yl28lt8zIR8E5/fc/PT5YfwRQgbhiRkhhBBCyEngd8wIIYQQQk4CT8wIIYQQQk4CT8wIIYQQQk7B6/V/iyx5knIrSXwAAAAASUVORK5CYIIA" alt="" />
修改密码并重启服务
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; #修改加密规则
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; #更新一下用户的密码
FLUSH PRIVILEGES; #刷新权限
5.变量赋值
用户变量,在客户端链接到数据库实例整个过程中用户变量都是有效的。 MySQL中用户变量不用事前申明,在用的时候直接用“@变量名”使用就可以了。 第一种用法:set @num=; 或set @num:=; //这里要使用set语句创建并初始化变量,直接使用@num变量 第二种用法:select @num:=; 或 select @num:=字段名 from 表名 where ……, select语句一般用来输出用户变量,比如select @变量名,用于输出数据源不是表格的数据。 注意上面两种赋值符号,使用set时可以用“=”或“:=”,但是使用select时必须用“:=赋值”
6.MYSQL5.7版本sql_mode=only_full_group_by问题
、关闭only_full_group_by 模式
、使用any_value(field)允许非分组字段出现
select count(*) as num,any_value(a.name)