ÔÚת´¢µÄÊý¾Ý¿âÖÐת´¢´æ´¢³ÌÐò(º¯ÊýºÍ³ÌÐò)¡£Ê¹ÓÃ---routines²úÉúµÄÊä³ö°üº¬CREATE PROCEDUREºÍCREATE FUNCTIONÓï¾äÒÔÖØд´½¨×Ó³ÌÐò¡£µ«ÊÇ£¬ÕâЩÓï¾ä²»°üÀ¨ÊôÐÔ£¬ÀýÈç×Ó³ÌÐò¶¨ÒåÕß»ò´´½¨ºÍÐÞ¸Äʱ¼ä´Á¡£Õâ˵Ã÷µ±ÖØÔØ×Ó³ÌÐòʱ£¬¶ÔËüÃǽøÐд´½¨Ê±¶¨ÒåÕßÓ¦ÉèÖÃΪÖØÔØÓû§£¬Ê±¼ä´ÁµÈÓÚÖØÔØʱ¼ä¡£
Èç¹ûÄãÐèÒª´´½¨µÄ×Ó³ÌÐòʹÓÃÔÀ´µÄ¶¨ÒåÕߺÍʱ¼ä´ÁÊôÐÔ£¬²»Ê¹ÓÃ--routines¡£Ïà·´£¬Ê¹ÓÃÒ»¸ö¾ßÓÐmysqlÊý¾Ý¿âÏàӦȨÏÞµÄMySQLÕË»§Ö±½Óת´¢ºÍÖØÔØmysql.proc±íµÄÄÚÈÝ¡£
show procedure status;
show create procedure autoinsert;
DELIMITER ;;
CREATE PROCEDURE `autoinsert`()
begin
declare i int;
set i=1;
while(i<100000)do
insert into t10 values (i,'name');
set i=i+1;
end while;
END;;
DELIMITER ;
±¸·Ýmysqldump -u root -p123 --socket=/usr/local/mysql1/var/mysql.sock -R --no-data --no-create-db --no-create-info --all-database > /root/mysqllog/test.sql
mysqldump -u root -p123 --socket=/usr/local/mysql1/var/mysql.sock mysql proc > /root/mysqllog/test.sql
»¹Ôsource /root/mysqllog/test.sql
use mysql
source /root/mysqllog/test.sql