MySQL Proxy°²×°ºÍʹÓÃ(Ò»)
°´ÕÕÊֲᰲװMySQL Proxy֮ǰÏÈÒª°²×°ÒÔÏÂÈí¼þ libevent 1.x or higher (1.3b or later is preferred) lua 5.1.x or higher glib2 2.6.0 or higher pkg-config libtool 1.5 or higher MySQL 5.0.x or higher developer files rpm²é¿´libevent $rpm -q libevent
libevent-1.1a-3.2.1 ÃãÇ¿ÓðÉ,¼ÒÏÂÀ´°²×°lua $tar xvzf lua-5.1.4.tar.gz $cd lua-5.1.4 $make linux $make install $cp etc/lua.pc /usr/local/lib/pkgconfig/ Ö®ºó°²×°MySQL Proxy°´×ªÊÀ¼ÌÐø±¨´í,ºÇºÇ,ËäÈ»ÊÖ²áÉ϶ÔÓÚglib2дµÄ°æ±¾ÊÇ2.6.0¼°ÒÔºóʵ¼ÊÔÚMySQL Proxy0.7.2ÉÏÊÇÒªÇó>2.16µÄ,¼ÌÐøÉý¼¶glib2 $tar xvzf glib-2.23.0.tar.gz $cd glib-2.23.0 $./configure $make $make install È»ºóÌáʾ°²×°libevent°æ±¾¹ýµÍ,ÔÎÁË $tar xvzf libevent-1.4.13-stable.tar.gz $cd libevent-1.4.13-stable $./configure $make $make install Õâ´ÎÔÙÈ¥°²×°MySQL Proxy $tar zxf mysql-proxy-0.7.2.tar.gz $cd mysql-proxy-0.7.2 $./configure --with-mysql=/usr/local/mysql/bin/mysql_config --with-lua $make $make install ĬÈϵÄmysql-proxy ±»°²×°µ½/usr/local/sbin/mysql-proxy¶øluaʵÀý½Å±¾ÔòÔÚ/usr/local/share/docÏÂ(²»¹ýºÃÏñÐèҪ֮ǰmake test²ÅÓÐ,²»È·¶¨). ²é¿´ÏÂMySQL ProxyµÄ°æ±¾ $mysql-proxy -V
mysql-proxy: error while loading shared libraries: /usr/local/lib/libmysql-chassis.so.0: cannot restore segment prot after reloc: Permission denied ±¨´í,ÕâÊÇSELinuxµÄÎÊÌâ,¿ÉÈçϽâ¾ö $chcon -t texrel_shlib_t /usr/local/lib/libmysql-chassis.so.0 $ mysql-proxy -V
mysql-proxy 0.7.2
glib2: 2.23.0
libevent: 1.4.13-stable
lua: Lua 5.1.4
LUA_PATH: /usr/local/lib/mysql-proxy/lua/?.lua
LUA_CPATH: /usr/local/lib/mysql-proxy/lua/?.so
2009-12-18 00:05:34: (warning) g_set_prgname() called multiple times
== plugins ==
admin: 0.7.0
proxy: 0.7.0 ÖÁ´ËMySQL Proxy°²×°Íê³É,¼ÇסLUA_PATH: /usr/local/lib/mysql-proxy/lua/?.luaÏÂÃæÒªÓõ½ Æô¶¯,±àÒëÆ
Ïà¹ØÎĵµ£º
MySQLµÄÒ²Ö§³Ö´æ´¢¹ý³Ì£¬º¯Êý£¬´¥·¢Æ÷¡£
ÒÔϸ÷¸ö¹¦ÄܵÄÏêÊö£¬Ö÷ÒªÊÇʾÀý¡£
/**1.¶¨Òå·Ö¸î·û*/
DELIMITER //
/**2.´´½¨º¯Êý-¼ÆËãÁ½ÊýÖ®ºÍ*/
CREATE FUNCTION f_sum(num1 INT,num2 INT) RETURNS INT
BEGIN
RETURN num1+num2;
END;
//
/**
*3.´´½¨´æ´¢¹ý³Ì
*˼·£º3.1.Óиô洢¹ý³ÌÔòɾ³ý£¬3.2ÓÐʹÓõÄÖмä±í ......
1¡¢±à¼MySQLÅäÖÃÎļþ£º
windows»·¾³ÖУº%MySQL_installdir%\my.ini¡¡//Ò»°ãÔÚMySQL°²×°Ä¿Â¼ÏÂÓÐmy.ini¼´MySQLµÄÅäÖÃÎļþ¡£
linux»·¾³ÖУº/etc/my.cnf
ÔÚ[MySQLd]ÅäÖöÎÌí¼ÓÈçÏÂÒ»ÐУº
skip-grant-tables
±£´æÍ˳ö±à¼¡£
2¡¢È»ºóÖØÆôMySQL·þÎñ
windows»·¾³ÖУº
net stop MySQL
net start MySQL
linux»·¾³ÖУº
/e ......
¿´MySQL²Î¿¼ÊÖ²á ·¢ÏÖCREATE TABLE ʱÓжàÖÖÊý¾Ý¿â´æ´¢ÒýÇ棺
TYPE = {BDB | HEAP | ISAM | InnoDB | MERGE | MRG_MYISAM | MYISAM }
ÍøÉϲéÁËϾÝ˵MyISAM¡¢InnoDBÁ½ÖÖÒýÇæ³£ÓÃ
´óÖÁÇø±ðÈçÏÂ[²»ÖªÊÇ·ñ׼ȷ]£º
¸ß¼¶´¦Àí:
MyISAMÀàÐͲ»Ö§³ÖÊÂÎñ´¦ÀíµÈ¸ß¼¶´¦Àí£¬¶øInnoDBÀàÐÍÖ§³Ö¡£
Ö´ÐÐËÙ¶È:
MyISAMÀàÐ͵ıíÇ¿µ÷µÄÊÇÐ ......
mysql×Ö·û¼¯±àÂëÏòÀ´ÊÇÒ»¸öÄÑÌ⣬ÒòΪÓÐʱºòΪ´ó¶àÊýÈËÏëµÄUTF8¿ÉÒÔ½â¾öһЩÄÑÌ⣬²»¹ý²»ÒªÌ«ÀíÏ뻯ÁË£¬ÓÐʱºòÔÚwindow¿Í»§¶ËÏ Ð޸ijÉutf8£¬mysqlÊDz»Ö§³ÖµÄ£¬ËùÒÔ»¹µÃ¾ßÌåÎÊÌâ¾ßÌå·ÖÎö£¬¿ÉÊÇÕâ¸ö»¹ÕæµÃÐèÒªÄ㻨µãʱ¼äÀ´Ñо¿
ÏÂÃæÊÇһЩ±ðÈ˵ÄÎÄÕ£¬ÔÚ´ËÏÈлÁË
& ......
Ê×ÏȲ¹³äÏÂMySQLµÄ±íËøÎÊÌâ(Ò»)û½²µ½µÄϵͳ¿ÉÒÔͨ¹ýÉèÖÃmax_write_lock_count²ÎÊýÀ´¿ØÖÆдµÄÓÅÏȼ¶,µ±Ò»¸ö±íµÄ¶ÁËø´ïµ½Õâ¸öÊýµÄʱºò,MySQL»áÔÝʱµÄ,½µµÍдµÄÓÅÏȼ¶.MySQL¾¡Á¿ÉÙÓÃһЩ¿´Ëƾ«Ã¸´ÔÓµÄÓï¾ä,ÒòΪÄ㸴ÔÓ¿ÉÄܵ¼Ö¸ø±í¼ÓµÄ¶ÁËøʱ¼ä¾Í³¤,»áµ¼ÖÂдµÄ²Ù×÷ÎÞ·¨½øÐÐ. innodbºÍMyISAM×î´óµÄÇø±ðÔÚÓÚinnodbÖ§³ÖÊÂÎñ´¦ ......