-- 존재시 삭제
drop procedure if exists test;
-- sp 생성
delimiter $$
create procedure test()
begin
set @i = 0;
while @i < 100 do
insert into dummpy (str) values('test');
set @i = @i + 1;
end while;
end$$
delimiter;
-- 실행
call test();
오래 걸리는 경우 mysql cli 로 실행을 걸어둔다.
# mysql-client 설치
sudo apt -y install mysql-client
# background 실행
mysql -u{아이디} -p{암호} -D{데이터베이스 이름} -h{DB 주소} -P{DB 포트} -e "call test();" > output.txt &
'DB' 카테고리의 다른 글
[redis] replication(master-slave) 및 sentinel(HA) 설치 테스트 - redis 5 on centos 7 (0) | 2019.07.26 |
---|---|
[mongodb] shard cluster 구성 (0) | 2019.07.18 |
[mongodb] replica set(cluster) PSS 구성 (0) | 2019.07.17 |
[mongodb] replica set(cluster) PSA 구성 (0) | 2019.07.17 |
mysql database 생성 (0) | 2018.11.13 |
[MYSQL] index, column 수정 쿼리 (0) | 2018.10.24 |
mysql character set 변경 (0) | 2018.06.04 |
mysql 전체 테이블 삭제 (0) | 2018.05.24 |