ÀûÓÃ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);
Ïà¹ØÎĵµ£º
Èç¹ûÔÚһЩ¸üÐÂÃüÁîÖ®ºó£¬mysqld×ÜÊǵ±µô£¬»òÕßÈç¹ûÄãÓöµ½±»ÆÆ»µµÄ±í£¬Äã¿ÉÒÔÓÃÏÂÃæµÄ²Ù×÷²âÊÔ¿´Õâ¸öȱÏÝÊÇ·ñÊÇ¿ÉÖظ´²úÉúµÄ£º
жµôMySQLÊØ»¤½ø³Ì£¨ÓÃmysqladmin shutdown£©¡£
¸ø¸Ã±í×ö±¸·Ý£¨·ÀÖ¹ÐÞ¸´²Ù×÷·´¶ø¸ã»µÕâÖֺܲ»¿ÉÄܳöÏÖµÄÇé¿ö£©¡£
Óà myisamchk -s database/*.MYI ¼ì²éËùÓÐµÄ±í£¬ÓÃmyisamchk -r database/ ......
MySQL ÃüÁîÐÐ
µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ÓÈëÒ»¸ö² ......
MySQL 5.1 ÊÇ MySQL Êý¾Ý¿âÄ¿Ç°·¢²¼µÄ×îеÄÎȶ¨°æ±¾£¨5.5ÊÇbeta״̬£¬6.0ÊÇalpha״̬£©¡£
¸Ã°æ±¾Ôö¼ÓÁ˶ÔÏÂÃ漸¸öƽ̨µÄÖ§³Ö£º
Mac OS X 10.6 x86/x64
HP-UX 11.31 IA64
SLES 11 x86/x64
InnoDB ²å¼þÉý¼¶µ½ 1.0.6 °æ±¾£¬ÁíÍâͨ¹ý¶Ô²éѯ»º´æµÄËéƬÓÅ»¯ÌáÉýÁËÐÔÄÜ£¬¸ü¶àÏêϸµÄÄÚÈÝÇë¿´ÕâÀï¡£
ÏÂÔصØÖ·£ºhttp://dev. ......
һֱϰ¹ßʹÓÃСдµÄSQL±£Áô×Ö£¬Ã»Ïëµ½½ñÌì¾ÓÈ»Óöµ½ÁËÂé·³¹þ£¡£¡ºÍгһÏÂMYSQLÀ²£¡
»·¾³£ºServer version: 5.1.37-1ubuntu5 (Ubuntu)
alter table child_table_name
add constraint constraint_name
foreign key (column_1)
references reference_table_name(reference_column_1);
ºÍ
ALTER TABLE child_t ......