MySql ´æ´¢¹ý³ÌÓαêʹÓÃʾÀý
DROP PROCEDURE IF exists pro_removeBillRemindByUserId;
create procedure pro_removeBillRemindByUserId(userId int)
begin
declare ts varchar(500);
declare cnt int default 0;
declare f_ID,b int;
DECLARE cur_1 CURSOR FOR select FID from t_bill where FUserId=userId;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET b = 1;
OPEN cur_1;
REPEAT
FETCH cur_1 INTO f_ID;
delete from t_bill_remind where FBillID=f_ID;
UNTIL b = 1
END REPEAT;
close cur_1;
end;
//µ÷Óô洢¹ý³Ì
call pro_removeBillRemindByUserId(678);
Ïà¹ØÎĵµ£º
Ê×ÏÈÐèÒª²é¿´Ò»Ï´´½¨º¯ÊýµÄ¹¦ÄÜÊÇ·ñ¿ªÆô£º
mysql> show variables like '%func%';
+-----------------------------------------+-------+
| Variable_name   ......
ÔÚ½üÆÚµÄÏîĿά»¤¹¤×÷ÖУ¬Ê±³£³öÏÖÖ÷¼üÖظ´µÄÒì³£¡£¾¹ýһϵÁÐ×ÊÁϵIJéѯ֮ºó£¬·¢ÏÖʱhibernateÓ³ÉäÎļþÅäÖÃÎÊÌâ¡£
mysqlÌṩÖ÷¼ü“×Ô¶¯ÔöÁ¿”µÄÅäÖã¬Ö¸¶¨¸ÃÀàÐ͵ÄÖ÷¼ü£¬mysqlÄܹ»×Ô¶¯¼ÓÒ»¡£
ÔÚhibernateÓ³ÉäÎļþÖУ¬¹ØÓÚÖ÷¼üµÄÅäÖò»ÄÜÊÇ
<generator class="increment"&g ......
1.²é¿´MySQL·ÖÇø±íµÄÖ´Ðмƻ®:
×¢Òâ:¶ÔMySQL·ÖÇø±í°´·ÖÇø²éѯ,²»ÓÃÏñOracleÄÇÑù,ÔÚSQLÖÐÌí¼Ó“PARTITION”×Ö·û´®¡£
Ìáʾ£ºÊ¹Ó÷ÖÇø¹¦ÄÜÖ®ºó£¬Ïà¹Ø²éѯ×îºÃ¶¼ÓÃEXPLAIN PARTITIONS¹ýÒ»±é£¬È·ÈÏ·ÖÇøÊÇ·ñÉúЧ¡£ÀýÈç:
EXPLAIN PARTITIONS SELECT * from tab_test WHERE created = '2008-01-02';
2.²é¿´MySQLÆÕͨ± ......
£¨1£©ÒÔubuntuµÄrootÓû§µÇ½
£¨2£©Í£Ö¹MYSQL·þÎñÆ÷£º
/etc/init.d/mysql stop
£¨3£©Ìø¹ýÊÚȨ±íÖ´ÐÐMYSQL·þÎñÆ÷£º
mysqld_safe --skip-grant-tables --skip-networking &
(×¢£º²ÎÊý--skip-grant-tablesΪÌø¹ýÊÚȨ±í£»--sk ......
ÔÚMySQL 3.23.44°æ±¾ºó£¬InnoDBÒýÇæÀàÐ͵ıíÖ§³ÖÁËÍâ¼üÔ¼Êø¡£
Íâ¼üµÄʹÓÃÌõ¼þ£º
1.Á½¸ö±í±ØÐëÊÇ
InnoDB±í£¬MyISAM±íÔÝʱ²»Ö§³ÖÍâ¼ü£¨¾Ý˵ÒÔºóµÄ°æ±¾ÓпÉÄÜÖ§³Ö£¬µ«ÖÁÉÙÄ¿Ç°²»Ö§³Ö£©£»
2.Íâ¼üÁбØÐ뽨Á¢ÁËË÷Òý£¬MySQL
4.1.2ÒÔºóµÄ°æ±¾ÔÚ½¨Á¢Íâ¼üʱ»á×Ô¶¯´´½¨Ë÷Òý£¬µ«Èç¹ûÔÚ½ÏÔçµÄ°æ±¾ÔòÐèÒªÏÔʾ½¨Á¢£»
3.Íâ¼ü¹Øϵµ ......