MySQLÊý¾Ý¿âË«»úÖ÷´ÓÈȱ¸·ÝÅäÖÃ(master-slave)

1¡¢mysql Êý¾Ý¿âûÓÐÔöÁ¿±¸·ÝµÄ»úÖÆ£¬µ±Êý¾ÝÁ¿Ì«´óµÄʱºò±¸·ÝÊÇÒ»¸öºÜ´óµÄÎÊÌâ¡£
»¹ºÃ mysql Êý¾Ý¿âÌṩÁËÒ»ÖÖÖ÷´Ó±¸·ÝµÄ»úÖÆ£¬Æäʵ¾ÍÊÇ°ÑÖ÷Êý¾Ý¿âµÄËùÓеÄÊý¾Ýͬʱдµ½±¸·ÝÊý¾Ý¿âÖС£ÊµÏÖ mysql Êý¾Ý¿âµÄÈȱ¸·Ý¡£

2¡¢ÒªÏëʵÏÖË«»úµÄÈȱ¸Ê×ÏÈÒªÁ˽âÖ÷´ÓÊý¾Ý¿â·þ...

    sqlrelay µÄ°²×°ÅäÖúÍÓ¦ÓÃ

Ò»¡¢SQL RelayÊÇʲô£¿

SQL RelayÊÇÒ»¸ö¿ªÔ´µÄÊý¾Ý¿â³ØÁ¬½Ó´úÀí·þÎñÆ÷

¶þ¡¢SQL RelayÖ§³ÖÄÄЩÊý¾Ý¿â£¿

    * Oracle
    * MySQL
    * mSQL
    * PostgreSQL
    * Syba...

    MysqlÈÕÆÚºÍʱ¼äº¯Êý²»ÇóÈË

¶ÔÓÚÿ¸öÀàÐÍÓµÓеÄÖµ·¶Î§ÒÔ¼°²¢ÇÒÖ¸¶¨ÈÕÆÚºÎʱ¼äÖµµÄÓÐЧ¸ñʽµÄÃèÊö¼û7.3.6 ÈÕÆÚºÍʱ¼äÀàÐÍ¡£

ÕâÀïÊÇÒ»¸öʹÓÃÈÕÆÚº¯ÊýµÄÀý×Ó¡£ÏÂÃæµÄ²éѯѡÔñÁËËùÓмǼ£¬Æädate_colµÄÖµÊÇÔÚ×îºó30ÌìÒÔÄÚ£º

mysql> SELECT something FROM table
WHERE TO_DAYS(NOW()) ...

    MySQLµÄÊý¾ÝÀàÐͺͽ¨¿â²ßÂÔ

¡¡¡¡ÎÞÂÛÊÇÔÚСµÃ¿ÉÁ¯µÄÃâ·ÑÊý¾Ý¿â¿Õ¼ä»òÊÇ´óÐ͵ç×ÓÉÌÎñÍøÕ¾£¬ºÏÀíµÄÉè¼Æ±í½á¹¹¡¢³ä·ÖÀûÓÿռäÊÇÊ®·Ö±ØÒªµÄ¡£Õâ¾ÍÒªÇóÎÒÃǶÔÊý¾Ý¿âϵͳµÄ³£ÓÃÊý¾ÝÀàÐÍÓгä·ÖµÄÈÏʶ¡£ÏÂÃæÎҾͽ«ÎÒµÄÒ»µãÐĵÃд³öÀ´¸ú´ó¼Ò·ÖÏí¡£

Ò»¡¢Êý×ÖÀàÐÍ

Êý×ÖÀàÐÍ°´ÕÕÎҵķÖÀà·½·¨·ÖΪÈýÀà...

    MYSQLË÷ÒýʹÓ㨶þ£©

Êý¾Ý¿âÖо­³£±»¼ìË÷µÄ±í£¬Ò»°ã¶¼ÉèÖÃË÷Òý£¬ÕâÑùÓÐÀûÓÚ²éѯЧÂʵÄÌá¸ß£¬ÌرðÊǺ£Á¿Êý¾Ý£¬ÏÂÃæ±¾ÎĽ«Ïêϸ½éÉÜË÷ÒýÔÚMysqlÖеÄʹÓã¡

    MYSQLË÷ÒýʹÓã¨Ò»£©

Êý¾Ý¿âÖо­³£±»¼ìË÷µÄ±í£¬Ò»°ã¶¼ÉèÖÃË÷Òý£¬ÕâÑùÓÐÀûÓÚ²éѯЧÂʵÄÌá¸ß£¬ÌرðÊǺ£Á¿Êý¾Ý£¬ÏÂÃæ±¾ÎĽ«Ïêϸ½éÉÜË÷ÒýÔÚMysqlÖеÄʹÓã¡

    linux ÎÊ´ðʽѧϰmysql

1 ʹÓÃrpm·½Ê½°²×°mysql

Ê×ÏÈÏÂÔغÏÊʵÄrpm°ü£¬ÀýÈçÏÂÔØÁËÎļþ MySQL-5.0.15-0.i386.rpm
ÓÃһϷ½·¨°²×°£º
#rpm -ivhU MySQL-5.0.15-0.i386.rpm
ͨ³£Çé¿öÏ£¬°²×°ÍêÕâ¸örpm°üºó£¬Ö»¾ß±¸ÓÐmysqld·þÎñ¹¦ÄÜ£¬ÆäËüÏà¹ØµÄclient³ÌÐòºÍ¿ª·¢°ü»¹ÐèÒªÁíÍâ°²×°
#rpm -i...

    MysqlÃüÁ½õ

MySQL³£ÓÃÃüÁî 
1¡¢MySQL³£ÓÃÃüÁî 
    create database name; ´´½¨Êý¾Ý¿â 

    use databasename; Ñ¡ÔñÊý¾Ý¿â 

    drop database name Ö±½Óɾ³ýÊý¾Ý¿â£¬²»ÌáÐÑ 

  &#...

    ×îÈ«µÄmysql²éѯÓï¾ä

--»ù±¾²éѯ
select * from pet

--ÁгöÖ¸¶¨µÄÁÐ
select name, owner form pet

--Ö±½Ó½øÐÐËãÊõÔËË㣬¶Ô×Ö¶ÎÆð±ðÃû
select sin(1+2) as sin

--whereÌõ¼þ
select * from pet where (birth>'1980' and species='dog') or species='bird'

--¶ÔnullµÄÌõ...

    SQL²éѯÓï¾ä´óÈ«

Ò»¡¢ ¼òµ¥²éѯ 
¼òµ¥µÄTransact-SQL²éѯֻ°üÀ¨Ñ¡ÔñÁÐ±í¡¢FROM×Ó¾äºÍWHERE×Ӿ䡣ËüÃÇ·Ö±ð˵Ã÷Ëù²éѯÁС¢²éѯµÄ±í»òÊÓͼ¡¢ÒÔ¼°ËÑË÷Ìõ¼þµÈ¡£
ÀýÈ磬ÏÂÃæµÄÓï¾ä²éѯtesttable±íÖÐÐÕÃûΪ"ÕÅÈý"µÄnickname×ֶκÍemail×ֶΡ£
 ¡¡¡¡SELECT nickname,email
FROM...

    JAVAÊý¾Ý¿â»ù±¾²Ù×÷Ïê½â

java Êý¾Ý¿â»ù±¾²Ù×÷
1¡¢javaÊý¾Ý¿â²Ù×÷»ù±¾Á÷³Ì
2¡¢¼¸¸ö³£ÓõÄÖØÒª¼¼ÇÉ£º
     ¿É¹ö¶¯¡¢¸üеļǼ¼¯
     ÅúÁ¿¸üÐÂ
     ÊÂÎñ´¦Àí

javaÊý¾Ý¿â²Ù×÷»ù±¾Á÷³Ì£ºÈ¡µÃÊý¾Ý¿âÁ¬½Ó - Ö´ÐÐsqlÓï¾ä - ...

    ´ÓMySQLµ¼Èëµ¼³ö´óÁ¿Êý¾ÝµÄ³ÌÐòʵÏÖ·½·¨

¡¡¡¡´ó¼ÒÒ»¶¨Ê¹Óùý phpmyadmin ÀïÃæµÄÊý¾Ý¿âµ¼È룬µ¼³ö¹¦ÄÜ£¬·Ç³£·½±ã¡£µ«ÊÇÔÚʵ¼ÊÓ¦ÓÃÖУ¬ÎÒ·¢ÏÖÈçϼ¸¸öÎÊÌ⣺
¡¡¡¡1¡¢Êý¾Ý¿â³¬¹ýÒ»¶¨³ß´ç£¬±ÈÈç6M ÕâʱʹÓõ¼³öÒ»°ãûÎÊÌ⣬¿ÉÒÔÕýÈ·µÄ±£´æµ½±¾»úÓ²ÅÌÉÏÃ棬µ«Êǵ¼ÈëÔò²»ÐÐ!Ô­ÒòÊÇ£ºÒ»°ãµÄ PHP.INI ÀïÃæÉèÖÃÁÙʱ...

    MySQLµÄÊý¾ÝÀàÐͺͽ¨¿â²ßÂÔ

¡¡¡¡ÎÞÂÛÊÇÔÚСµÃ¿ÉÁ¯µÄÃâ·ÑÊý¾Ý¿â¿Õ¼ä»òÊÇ´óÐ͵ç×ÓÉÌÎñÍøÕ¾£¬ºÏÀíµÄÉè¼Æ±í½á¹¹¡¢³ä·ÖÀûÓÿռäÊÇÊ®·Ö±ØÒªµÄ¡£Õâ¾ÍÒªÇóÎÒÃǶÔÊý¾Ý¿âϵͳµÄ³£ÓÃÊý¾ÝÀàÐÍÓгä·ÖµÄÈÏʶ¡£ÏÂÃæÎҾͽ«ÎÒµÄÒ»µãÐĵÃд³öÀ´¸ú´ó¼Ò·ÖÏí¡£

Ò»¡¢Êý×ÖÀàÐÍ

Êý×ÖÀàÐÍ°´ÕÕÎҵķÖÀà·½·¨·ÖΪÈýÀà...

    ÇáËÉÕÆÎÕÓÃSQLÀ´ºÏ²¢²éѯ

¡¡¡¡ÄãÊÇ·ñÔø¾­ÎªÁ˵õ½ËùÐèÒªµÄÐÅÏ¢¶ø·´¸´²éѯ?×ÓÑ¡Ôñ£¬Ò²±»³ÆΪ×Ó²éѯ£¬Ò²ÐíÕýÊÇÄãÔÚÑ°Õҵġ£SQLµÄÕâÏÄÜʹÄã¿ÉÒÔÔÚÒ»×é½á¹ûÖвéѯ£¬´´ÔìÐԵظø½á¹û×é¼ÓÒÔÏÞ¶¨£¬»òÊÇÔÚÏòÊý¾Ý¿âµÄµ¥Ò»µ÷ÓÃÖн«½á¹ûÓëÒ»¸öÎÞ¹ØϵµÄ²éѯ×öÏà¹Ø¡£ÕâƪÎÄÕÂÖн«¸ø³ö¼¸¸ö×ÓÑ¡ÔñµÄÀý×Ó²¢...

    ÎåÖÖÊý¾Ý¿â³£ÓÃsqlÓï¾äÊÕ²Ø

ƽʱÊղصÄÎåÖÖ³£ÓÃsqlÓï¾ä£¬ÄóöÀ´¹²Ïíһϣ¬»òÐíÄÜÓõÄ×Å£¡

    SQLÓï¾äleft join/right join/inner join µÄÓ÷¨±È½Ï

¼ÙÉèÓÐA£¬BÁ½¸ö±í¡£

±íA¼Ç¼ÈçÏ£º
aID¡¡¡¡¡¡¡¡¡¡aNum
1¡¡¡¡¡¡¡¡¡¡a20050111
2¡¡¡¡¡¡¡¡¡¡a20050112
3¡¡¡¡¡¡¡¡¡¡a20050113
4¡¡¡¡¡¡¡¡¡¡a20050114
5¡¡¡¡¡¡¡¡¡¡a20050115

±íB¼Ç¼ÈçÏÂ:
bID¡¡¡¡¡¡¡¡¡¡bName
1¡¡¡¡¡¡¡¡¡¡2006032401
2¡¡¡¡¡¡¡¡¡¡2006032402
...

    MySQLµÄbenchmarkº¯Êý

MySQLʵÏÖÁ˺ܶà¶ÀÌصĺ¯Êý£¬ÓÐʱºòʹÓÃÆðÀ´ÊǷdz£µÄ·½±ã£¬»òÐíÕâ¾ÍÊÇ¿ªÔ´µÄºÃ´¦°É¡£ÕâÀï¼Ç¼һÏÂbenchmarkº¯Êý£¬Ò»¸öÓÃÓÚ²âÊÔMySQLº¯ÊýÐÔÄܵĺ¯Êý¡£benchmarkº¯ÊýÖ»ÓÐÁ½¸ö²ÎÊý£¬µÚÒ»¸öÊÇÖ´ÐдÎÊý£¬µÚ¶þ¸öÊÇÒª²âÊԵĺ¯Êý»òÕß±í´ïʽ¡£·µ»ØµÄ½á¹ûʼÖÕÊÇ0£¬Ö´ÐÐʱ¼ä²ÅÊÇ...

    MySQLÊý¾Ý¿âº¯ÊýÏê½â

MySQLÊý¾Ý¿âº¯ÊýÏê½â
(1) int mysql_affected_rows([int link_id]);

ÔÚ¸ø¶¨µÄÁ¬½ÓÖУ¬·µ»ØÓÉ×î½üµÄDELETE¡¢INSERT¡¢REPLACE»òÕßUPDATEÓï¾äËù×÷ÓõÄÐÐÊý¡£Èç¹ûûÓÐÐÐ ±»Ð޸ģ¬Ôòmysql_affected_rows()·µ»Ø0£¬Èç¹û³öÏÖ´íÎó£¬Ôò·µ»Ø-1¡£
ÔÚSELECT²éѯ֮ºó£¬mysql_a...

    ¿ìËÙÕÆÎÕMySQLÊý¾Ý¿âÖÐSELECTÓï¾ä

¡¡¡¡±¾ÎÄÕë¶ÔMySQLÊý¾Ý¿âÖеÄSELECTÓï¾ä¿ìËÙ¾«Ï¸ÕÆÎÕ¡£
¡¡¡¡MySQLÖÐSELECTÓï¾äµÄ»ù±¾Óï·¨ÊÇ£º




ÒÔÏÂÊÇÒýÓÃƬ¶Î£º
SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT]
[SQL_BIG_RESULT] [HIGH_PRIORITY]
...

    MYSQL³ö´í´úÂ뺬ÒåÁбí

¡¡¡¡1005£º´´½¨±íʧ°Ü

1006£º´´½¨Êý¾Ý¿âʧ°Ü

1007£ºÊý¾Ý¿âÒÑ´æÔÚ£¬´´½¨Êý¾Ý¿âʧ°Ü

1008£ºÊý¾Ý¿â²»´æÔÚ£¬É¾³ýÊý¾Ý¿âʧ°Ü

1009£º²»ÄÜɾ³ýÊý¾Ý¿âÎļþµ¼ÖÂɾ³ýÊý¾Ý¿âʧ°Ü

1010£º²»ÄÜɾ³ýÊý¾ÝĿ¼µ¼ÖÂɾ³ýÊý¾Ý¿âʧ°Ü

1011£ºÉ¾³ýÊý¾Ý¿âÎļþʧ°Ü

1012...