MYSQL可重复执行脚本添加索引,字段

MYSQL可重复执行脚本添加索引,字段,第1张

添加字段

drop procedure if exists add_column_if;

delimiter $$

create procedure add_column_if()

begin

declare

iCnt int

select count(*) into iCnt from information_schema.columns

where table_schema=(select database())

and table_schema='BONDCONTRACE_TEST'

andcolumn_name='AAA'

if (iCnt=0) then

alter table bondcontrac_test add  AAA varchar(10) default null

end if

end

call add_column_if

drop procedeure add_column_if$$

delimiter

加索引

drop  procedure if exits add_index_id

delimiter $$

create procedure add_index()

begin

declare iCint int

select count(*) from information_schema.statistcs

where table_schema=''

and table_name=''

and index_name=''

and column_name in ('','')

if (iCint=0) then

alter table tablename add key index_name('','')

end if

end'

call add_index_if

drop procedure add_index_if$$

delimiter

你想的是mysql如何添加txreadyonly吗?通过设置添加。

1、在MySQL中,打开设置

2、使用管理员用户登录MySQL数据库,执行以下命令,将数据库设置为只读模式。

3、执行后,如果没有报错,说明设置成功。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/7905973.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-11
下一篇2023-04-11

发表评论

登录后才能评论

评论列表(0条)

    保存