0%

mysql百宝箱

Text类型的大小区别

https://www.cnblogs.com/exmyth/p/8747293.html

表头 表头
TINYTEXT 256 bytes *
TEXT 65,535 bytes ~64kb
MEDIUMTEXT 16,777,215 bytes ~16MB
LONGTEXT 4,294,967,295 bytes ~4GB

设置外键

1
alter table `limited` add constraint fk_limited_goods_id foreign key(goods_id) references `goods`(id);

mysql8.0转旧版本的验证方式

8.0安全验证方式:

caching_sha2_password

1
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'sdb@2019';

concat用法

1
select concat('{value:\'',code,'\',label:\'',name,'\',children:[',(select concat(GROUP_CONCAT(CONCAT('{value:\'',b.code,'\',label:\'',b.name,'\'}')),']},') from area b where b.parent_code=a.code group by b.parent_code)) from area a where layer=0