MySQL changes the type of all tables in a database containing a certain field to other types

Use sql to query all tables containing the field and install it with list

 select TABLE_NAME '表名',
 
FROM
 
 information_schema. COLUMNS
 
WHERE
 
 TABLE_SCHEMA = 'mallplus-saas'
 
AND COLUMN_NAME = '字段'
使用sql语句:alter table 表名 change 需要改变的字段 改变后的字段 改变的类型
循环去修改所有的字段类型

Guess you like

Origin blog.csdn.net/weixin_45528650/article/details/109094182