ÀûÓÃmysqlº¯Êý¸üÐÂmemcached
Memcached Functions for MYSQL¹Ù·½Ö÷Ò³£º
https://launchpad.net/memcached-udfs
Á½Æª»ù±¾ÎÄÕ£º
http://www.libing.name/2009/02/06/mysql-map-data-to-memcached.html
http://www.libing.name/2008/02/26/mysql-map-memcached.html
°²×°ºÍÑéÖ¤µÄSQLÓï¾ä£º
http://hg.tangent.org/memcached_functions_mysql/file/724eeccc55bc/README
°²×°£º
1.°²×°mysql
2.°²×°memcached
3.Æô¶¯mysql,memcached
/usr/local/bin/memcached -p 22222 -m 64m -u root -d
4.°²×°Memcached Functions for MYSQL
tar xzvf memcached_functions_mysql-0.2.tar.gz
cd memcached_functions_mysql-0.2
./configure –with-mysql=MYSQL_DIR/bin/mysql_config –libdir=MYSQL_DIR/lib/mysql/
make
make install
5.½«UDFs¼ÓÔØµ½MySQLÖУ¨UDF=User Defined Function£©
memc_servers_set()
mysql> create function memc_servers_set returns int soname "libmemcached_functions_mysql.so";
memc_set()
mysql> create function memc_set returns int soname "libmemcached_functions_mysql.so";
memc_get()
mysql> create function memc_get returns string soname "libmemcached_functions_mysql.so";
memc_delete()
mysql> create function memc_delete returns string soname "libmemcached_functions_mysql.so";
......
ÆäËûº¯ÊýµÄ¼ÓÔØÊ¡ÂÔ
6.ÑéÖ¤
select memc_servers_set('127.0.0.1:22222');
select memc_set('key','value');
select memc_get('key');
select memc_delete('key');
7.´¥·¢Æ÷¸üÐÂmemcached
£¨1£©´´½¨±í
create table memc_test(
key varchar(100),
value varchar(100)
);
£¨2£©´´½¨´¥·¢Æ÷
delimiter ;;
create trigger memc_add after insert on memc_test for each row begin
select memc_set(NEW.key,NEW.value);
end;;
delimiter ;
delimiter ;;
create trigger memc_update after update on memc_test for each row begin
select memc_set(NEW.key,NEW.value);
Ïà¹ØÎĵµ£º
×î½üÔÚÑо¿CMS£¬ÔÚÊý¾Ýת»»µÄʱºòÐèÒªÓõ½mysqlµÄreplaceº¯Êý£¬ÕâÀï¼òµ¥½éÉÜһϣ¡
±ÈÈçÄãÒª½« ±í tb1ÀïÃæµÄ f1×ֶεÄabcÌæ»»Îªdef
UPDATE tb1 SET f1=REPLACE(f1, 'abc', 'def');
REPLACE(str,from_str,to_str)
ÔÚ×Ö·û´® str ÖÐËùÓгöÏÖµÄ×Ö·û´® from_str&nbs ......
MySQL ÃüÁîÐÐ
µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ÓÈëÒ»¸ö² ......
http://hi.baidu.com/tianxia_1209/blog/item/a2613822fec7e7f6d6cae267.html
MYSQLµÄʼþÊÇ5.1ÐÂÔö¼ÓµÄ£¬Èç¹ûÏëÌåÑ飬½¨ÒéÉý¼¶°æ±¾¡£
ÖÁÓÚÓï·¨ÎҾͲ»¶à˵ÁË£¬ÊÖ²áÉϽ²µÄºÜÏêϸ£¬ÎÒÀ´ËµËµ¼¸¸öÒªµãÒÔ¼°Ò»Ð©ÊµÀý¡£
×¢ÒâÊÂÏ
1¡¢EVENTȨÏÞÊÇÕë¶ÔģʽµÄ£¨ÔÚMYSQLÖÐÒ²¾ÍÊÇ¿âµÄ¼¶±ð£©£¬²»ÄܶԵ¥¶À±íÀ´¸³ÓèȨÏÞ¡£
2¡¢±ØÐëÔÚ ......