1、第一步执行
show variables like 'group_concat_max_len';
SET GLOBAL group_concat_max_len=1024000;
SET @@GROUP_CONCAT_MAX_LEN = 1024000;
2、第二步执行
select GROUP_CONCAT(concat_ws(',',COLUMN_NAME,DATA_TYPE,coalesce(TRIM(COLUMN_COMMENT),COLUMN_NAME),TABLE_NAME,table_comment,PriKey) SEPARATOR "~")
FROM
(
select distinct c.*,t.table_comment,pri.PriKey from information_schema.columns c
LEFT JOIN information_schema.TABLES t on c.TABLE_NAME=t.TABLE_NAME
LEFT JOIN
(
select CONCAT('[',GROUP_CONCAT(concat_ws('@',COLUMN_NAME,EXTRA) SEPARATOR "|"),']') as PriKey,TABLE_NAME from information_schema.columns c
where c.table_name='tb_user_info' and c.TABLE_SCHEMA='youtiygd' and column_key='PRI'
) pri on c.TABLE_NAME=pri.TABLE_NAME
where c.table_name='tb_user_info' and c.TABLE_SCHEMA='youtiygd'
)a