MySQL Proxy °²×°Óë¶Áд·ÖÀëÌåÑé
Ô×÷£ºÑîÌÎ(ÉϵÛËû°Ö)
Ò»Ö±ÏëµÈµ½BETA°æ³öÀ´ÔÙÊÔÑéµÄ£¬¿É»¹ÊǾ²»×¡ÓÕ»ó°¢,ÏÂÎçÖÕÓÚÓÐʱ¼ä²âÊÔÒ»ÏÂÁË¡£
£¨±¾ÎIJο¼µØÖ·£ºhttp://blog.chinaunix.net/u/8111/showart.php?id=451420£©
Ò»¡¢±Ø±¸Èí¼þ£º
1¡¢LUA
¿ÉÒÔÈ¥LUAµÄ¹Ù·½ÏÂÔØ£ºwww.lua.org
2¡¢MySQL Proxy
ÕâÀïÓкöà¶þ½øÖÆ°æ±¾¡£
http://mysql.cdpa.nsysu.edu.tw/Downloads/MySQL-Proxy/
»òÕßÈ¥MYSQL¹Ù·½ÏÂÔØÔ´´úÂë¡£
3¡¢²âÊÔ¹ý³ÌÖÐÈ¡ÏûÁËBºÍCµÄREPLICATION¡£ÕâÑùSQLÓï¾äÒ»ÏÂ×ӾͿ´³öÀ´´ÓÄÄÀïÀ´µÄ¡£
Èç¹ûÊÇM-S£¨¿ÉÒÔÏÈÔÚSLAVEÉϽøÐÐSTOP SLAVE£©
¶þ¡¢²âÊÔÖ÷»úµØÖ·£º
1¡¢MySQL Proxy °²×°µØÖ·£º192.168.0.234(¼ò³ÆA)
2¡¢MySQL ·þÎñÆ÷µØÖ·£º192.168.0.235(¼ò³ÆB)/236(¼ò³ÆC)
Èý¡¢°²×°ÌåÑé
Èç¹ûÊÇ°´ÕÕ¶þ½øÖÆ°ü°²×°µÄ£¬Ìø¹ýÕâÒ»²½¡£
1¡¢ LUAµÄ°²×°
[root@localhost ~]#tar zxvf lua-5.1.2.tar.gz -C /usr/local
[root@localhost ~]# cd /usr/local/
[root@localhost local]# mv lua-5.1 lua
[root@localhost lua]# cd lua
[root@localhost lua]#make local;make install;
µ¼³ö»·¾³±äÁ¿£º
[root@localhost lua]#export LUA_CFLAGS="-I/usr/local/include" LUA_LIBS="-L/usr/local/lib -llua -ldl" LDFLAGS="-lm"
2¡¢MySQL Proxy °²×°
[root@localhost ~]#tar -zxvf mysql-proxy-0.6.1-linux-rhel4-x86-32bit.tar.gz -C /usr/local/mysql/
[root@localhost ~]#cd /usr/local/mysql
[root@localhost mysql]#mv mysql-proxy-0.6.1-linux-rhel4-x86-32bit/ mysql-proxy
[root@localhost sbin]# export PATH=$PATH:/usr/local/mysql/mysql-proxy/sbin/
ËÄ¡¢Ê¹ÓÃMySQL Proxy
1¡¢²é¿´°ïÖúÑ¡Ïî
[root@localhost ~]# mysql-proxy --help-all
2¡¢¶ÔMySQL ²Ù×÷
MySQL·þÎñÆ÷¼ÙÉèÒѾ°²×°¡£(°²×°²½ÖèÕâÀï¾Í²»Ð´ÁË)
Á½Ì¨»úÆ÷Éϵıí³õʼ½á¹¹ºÍÊý¾Ý¶¼ÊÇÒ»ÑùµÄ£¬¶øÇÒ¶¼ÓÐt_girl_userÕâ¸öÓû§¡£
mysql> desc t;
+-------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+----------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL
Ïà¹ØÎĵµ£º
ÔÚ±íÖÐÒÑÓдóÁ¿µÄindexµÄÇé¿öϲåÈë´óÁ¿Êý¾Ý£¬¿ÉÒÔ²ÉÓÃÏȽ«Ë÷Òýɾ³ý£¬È»ºóÔÙ²åÈëÊý¾Ý£¬È»ºóÔÙÖØн¨Á¢Ë÷Òý¡£Ö®ËùÒÔÕâÑù»á¿ìÊÇÒòΪ£¿£¿£¿
7.2.14 Speed of INSERT Statements
The time to insert a record is determined by the following factors, where the numbers indicate approximate proportions:
& ......
update £ºµ¥±íµÄ¸üв»ÓÃ˵ÁË£¬Á½ÕßÒ»Ñù£¬Ö÷Ҫ˵˵¶à±íµÄ¸üÐÂ
Oracle> OracleµÄ¶à±í¸üÐÂÒªÇó±È½ÏÑϸñ£¬ËùÒÔÓеÄʱºò²»ÊǺܺÃд£¬ÎÒÃÇ¿ÉÒÔÊÔÊÔOracleµÄÓαê
&n ......
1¡¢MySQL³£ÓÃÃüÁî
create database name; ´´½¨Êý¾Ý¿â
use databasename; Ñ¡ÔñÊý¾Ý¿â
drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ
show tables; ÏÔʾ±í
describe tablename; ±íµÄÏêϸÃèÊö
select ÖмÓÉÏdistinctÈ¥³ýÖظ´×Ö¶Î
mysqladmin drop databasename ɾ³ýÊý¾Ý¿âÇ°£¬ÓÐÌáʾ¡£
ÏÔʾµ±Ç°mysql°æ±¾ºÍµ±Ç°È ......
## **********first test,procedure**********
#<1>
use testprocedure;
delimiter //
create procedure simpleproce1 (out par1 int)
begin
select count(*) into par1 from proce;
end
//
delimiter ;
call simpleproce1(@a);
select @a;
#<2>,ÿ´ÎÖ»Óе¥Ò»µÄÐпÉÒÔ±»È¡»Øselect id,name i ......
1.Á¬½ÓMySQLÊý¾Ý¿â
echo on¡¡¡¡
cd c:\Program Files\MySQL\MySQL Server 5.2\bin
mysql -uroot -ppass
2¡¢ÏÔʾÊý¾Ý¿âÁÐ±í¡£
show databases;
3¡¢ÏÔʾ¿âÖеÄÊý¾Ý±í£º
use mysql; //´ò¿ª¿â£¬
show tables;
4¡¢ÏÔʾÊý¾Ý±íµÄ½á¹¹£º
describe ±íÃû;
5¡¢½¨¿â£º
create database ¿âÃû;
6¡¢½¨±í£º
use ¿âÃû;
creat ......