mysql´æ´¢¹ý³Ì¼°º¯Êý
×¢Ò⣺mysqlÖеÄÓû§±äÁ¿µÄÉúÃüÖÜÆÚÊǻỰ¼¶µÄ£¬²»ÊÇÓï¾ä¼¶µÄ£¡
´æ´¢¹ý³Ì--------------------------------------------------
drop procedure if exists usp_simple;
delimiter //
create procedure usp_simple(in ip int, out op int, inout iop int)
begin
select count(*) into op from t1;
set op = op + ip;
set iop = iop * 2;
end;
//
delimiter;
Ö´ÐУº
set @iop = 3;
call usp_simple(6,@op,@iop);
select @op,@iop
------------------------------
drop procedure if exists usp_simple2;
delimiter //
create procedure usp_simple2()
begin
select * from t1;
end;
//
delimiter;
Ö´ÐУº
call usp_simple2();
º¯Êý------------------------------------------------------
delimiter //
CREATE FUNCTION hello (s CHAR(20)) RETURNS CHAR(50)
RETURN CONCAT('Hello, ',s,'!');
//
delimiter ;
SELECT hello('world');
-------------------------------------------------------------
×¢ÒâÔÚ¸´ÖÆϵͳÀ´æ´¢¹ý³ÌºÍº¯ÊýµÄÈ·¶¨ÐÔ£¬ÕâÒ»µã·Ç³£ÖØÒª£¡£¡£¡£¡
ÔÚÖ÷·þÎñÆ÷ÉÏ£¬³ý·Ç×Ó³ÌÐò±»ÉùÃ÷Ϊȷ¶¨ÐԵĻòÕß²»¸ü¸ÄÊý¾Ý£¬·ñÔò´´½¨»òÕßÌæ»»×Ó³ÌÐò½«±»¾Ü¾ø¡£Ä¬ÈÏÇé¿öÏ´´½¨SP»òÕßFN¿Ï¶¨»áÓöµ½1418µÄ´íÎóºÅ¡£
½â¾ö°ì·¨£º
ÔÚÑ¡ÏîÎļþÀÅäÖÃlog_bin_trust_routine_creators=1¡£Mysql»áÈÏΪËùÓд´½¨×Ó³ÌÐòµÄ´´½¨Õ߶¼ÊÇ¿ÉÒÔÐÅÈεģ¬´´½¨µÄ×Ó³ÌÐò¶¼ÊÇÈ·¶¨µÄ¡£
²»È·¶¨ÐÔ×Ó³ÌÐò¾ÙÀý£º
1. ------------------------------------
CREATE FUNCTION myfunc () RETURNS INT
· BEGIN
· INSERT INTO t (i) VALUES(1);
· RETURN 0;
· END;
°´ÕÕÉÏÃ涨Ò壬ÏÂÃæµÄÓï¾äÐ޸ıít£¬ÒòΪmyfunc()Ð޸ıít, µ«ÊÇÓï¾ä²»±»Ð´½ø¶þ½øÖÆÈÕÖ¾£¬ÒòΪËüÊÇÒ»¸öSELECTÓï¾ä£º
SELECT myfunc();
2.--------------------------------------
delimiter //
Ïà¹ØÎĵµ£º
MySQLÖØа²×°µÄʱºò³öÏÖÁËÎÊÌ⣺Could not start the service MySQL. Error:0,ÔÒòÊÇûÓжԾɵÄMySQLÍêȫжÔصô¡£
ÔÚÄã´ÓµçÄÔÀïжÔؾɵÄMYSQLÊý¾Ý¿â·þÎñʱ£¬Ê×ÏÈÏÈÔÚWINDOWS·þÎñÀïÍ£µôMYSQLµÄ·þÎñ¡£ÔÙµ½¿ØÖÆÃæ°åÀïµÄÔö¼Óɾ³ý³ÌÐòÄÚ½øÐÐɾ³ý£¬È»ºóÊÖ¶¯É¾³ýÔ°²×°Îļþ,µ«ÊÇÄã²¢²»ÄÜÍêÕûµÄ°ÑMYSQL·þÎñɾ ......
½ñÌìÔÚʵ¼Ê¿ª·¢ÖжÔÓÚMySQLÊý¾Ý¿â½øÐÐÒÆÖ²·¢ÉúµÄÎÊÌâÀ´ËµÏÂ. ¿ªÊ¼°Ñ±¾µØdataÖеÄÊý¾Ý¿âÎļþ¿½±´µ½Áíһ̨»ú×ÓÉÏTest, Ö´ÐÐshow tables ; ¿ÉÒÔ¿´µ½Êý¾Ý¿â±í,µ«ÊǶԱí½øÐÐÈκβÙ×÷¶¼±¨´í: ±í²»´æÔÚ , ÔÒÔΪMysqlµÄÊý¾Ý¿âÎļþ(.frm)Copy->stickµ½±¾µØ°²×°MySQLDBĿ¼µÄdataÎļþ¼ÐϾͿÉÒÔ.ÊÂʵ²»Ê ......
CENTOS 5µÄÐéÄâ»ú£¬Ôõô´ÓͼÐνçÃæÇл»µ½ÃüÁîÐнçÃæ
1.ÁÙʱÇл»£º
ctrl+alt+1 …… ctrl+alt+6Ò»¹²Áù¸ö¿ØÖÆ̨¡£
2.ÓÀ¾Ã¹Ø±ÕͼÐλ¯£º
ÔÚrootÏÂÊäÈë vi /etc/inittab ½«init:5ÐÞ¸ÄΪinit:3
Mysql rpm°ü°²×°£¬²»ÄÜÖض¨Î»(relocatable)
rpm°ü°²×°Òì³££¬--prefix ²ÎÊý²»ÄÜÖض¨Î»£¬°²×°µ½ÁíÒ»¸öĿ¼µÄÔ ......
·ÖÒ³¹¦ÄܵÄʵÏÖÊÇÿÖÖWEB¿ª·¢ÓïÑÔ±ØÐëҪʵÏֵŦÄÜ¡£PHPÒ²ºÃ,JSPÒ²°Õ¡£ÎÒ×¼±¸ÓÃÁ½¸ö·½·¨À´²ûÊöPHP+MYSQLʵÏÖ·ÖÒ³µÄ¹¦ÄÜ¡£
Ò»¡¢·ÖÒ³³ÌÐòµÄÔÀí
·ÖÒ³³ÌÐòÓÐÁ½¸ö·Ç³£ÖØÒªµÄ²ÎÊý£ºÃ¿Ò³ÏÔʾ¼¸Ìõ¼Ç¼£¨$pagesize£©ºÍµ±Ç°Êǵڼ¸Ò³£¨$page£©¡£ÓÐÁËÕâÁ½¸ö²ÎÊý¾Í¿ÉÒԺܷ½±ãµÄд³ö·ÖÒ³³ÌÐò£¬ÎÒÃÇÒÔMySqlÊý¾Ý¿â×÷ΪÊý¾ÝÔ´£¬ ......
ʹÓÃÁÙʱ±íµÄºÃ´¦£º
ʹÓÃÁÙʱ±í´æ·ÅÖмä½á¹û,¼ÓËÙ²éѯ£¬»ò´æ·ÅÁÙʱ½á¹û.
(1)
´´½¨ÁÙʱ±íºÜÈÝÒ×£¬¸øÕý³£µÄCREATE TABLEÓï¾ä¼ÓÉÏTEMPORARY¹Ø¼ü×Ö£º
CREATE TEMPORARY TABLE tmp_table (
name VARCHAR(10) NOT NULL,
value INTEGER NOT NULL
)
(2)
ÁÙʱ±í½«ÔÚÄãÁ¬½ÓMySQLÆÚ¼ä´æÔÚ¡£µ±Äã¶Ï¿ªÊ±£¬MySQL ......