锘??xml version="1.0" encoding="utf-8" standalone="yes"?>韩国精品一区二区,色一情一乱一伦一区二区三区丨,在线观看av每日更新免费http://www.aygfsteel.com/liangcmwn/category/49243.htmlzh-cnWed, 24 Aug 2011 07:27:16 GMTWed, 24 Aug 2011 07:27:16 GMT60MySQL鍚屾鏁呴殰錛? Slave_SQL_Running:No" 涓ょ瑙e喅鍔炴硶 http://www.aygfsteel.com/liangcmwn/articles/356604.htmlliangcmwnliangcmwnTue, 16 Aug 2011 01:31:00 GMThttp://www.aygfsteel.com/liangcmwn/articles/356604.htmlhttp://www.aygfsteel.com/liangcmwn/comments/356604.htmlhttp://www.aygfsteel.com/liangcmwn/articles/356604.html#Feedback0http://www.aygfsteel.com/liangcmwn/comments/commentRss/356604.htmlhttp://www.aygfsteel.com/liangcmwn/services/trackbacks/356604.html

榪涘叆slave鏈嶅姟鍣紝榪愯錛?/p>

mysql> show slave status\G

         .......
             Relay_Log_File: localhost-relay-bin.000535
              Relay_Log_Pos: 21795072
      Relay_Master_Log_File: localhost-bin.000094
           Slave_IO_Running: Yes
          Slave_SQL_Running: No
            Replicate_Do_DB: 
        Replicate_Ignore_DB: 
      ......

瑙e喅鍔炴硶涓銆?/strong>

Slave_SQL_Running: No
1.紼嬪簭鍙兘鍦╯lave涓婅繘琛屼簡(jiǎn)鍐欐搷浣?/p>

2.涔熷彲鑳芥槸slave鏈哄櫒閲嶈搗鍚庯紝浜嬪姟鍥炴粴閫犳垚鐨?

涓鑸槸浜嬪姟鍥炴粴閫犳垚鐨勶細(xì)
瑙e喅鍔炴硶錛?br style="line-height: 22px; " />mysql> slave stop;
mysql> set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
mysql> slave start;

 

瑙e喅鍔炴硶浜屻?/p>

棣栧厛鍋滄帀Slave鏈嶅姟錛歴lave stop
鍒頒富鏈嶅姟鍣ㄤ笂鏌ョ湅涓繪満鐘舵侊細(xì)
璁板綍File鍜孭osition瀵瑰簲鐨勫?/p>

榪涘叆master

mysql> show master status;
+----------------------+----------+--------------+------------------+
| File                 | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+----------------------+----------+--------------+------------------+
| localhost-bin.000094 | 33622483 |              |                  | 
+----------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

 

鐒跺悗鍒皊lave鏈嶅姟鍣ㄤ笂鎵ц鎵嬪姩鍚屾錛?br style="line-height: 22px; " />
mysql> change master to 
> master_host='master_ip',
> master_user='user', 
> master_password='pwd', 
> master_port=3306, 
> master_log_file=localhost-bin.000094', 
> master_log_pos=33622483 ;
1 row in set (0.00 sec)
mysql> slave start;
1 row in set (0.00 sec)

 

mysql> show slave status\G
*************************** 1. row ***************************
........
            Master_Log_File: localhost-bin.000094
        Read_Master_Log_Pos: 33768775
             Relay_Log_File: localhost-relay-bin.000537
              Relay_Log_Pos: 1094034
      Relay_Master_Log_File: localhost-bin.000094
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes

            Replicate_Do_DB:

鎵嬪姩鍚屾闇瑕佸仠姝aster鐨勫啓鎿嶄綔錛?nbsp;



liangcmwn 2011-08-16 09:31 鍙戣〃璇勮
]]>
MySQL InnoDB瀛樺偍寮曟搸鐨勪簨鍔¢殧紱葷駭鍒?/title><link>http://www.aygfsteel.com/liangcmwn/articles/356601.html</link><dc:creator>liangcmwn</dc:creator><author>liangcmwn</author><pubDate>Tue, 16 Aug 2011 01:15:00 GMT</pubDate><guid>http://www.aygfsteel.com/liangcmwn/articles/356601.html</guid><wfw:comment>http://www.aygfsteel.com/liangcmwn/comments/356601.html</wfw:comment><comments>http://www.aygfsteel.com/liangcmwn/articles/356601.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/liangcmwn/comments/commentRss/356601.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/liangcmwn/services/trackbacks/356601.html</trackback:ping><description><![CDATA[<span id="wmqeeuq" class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; background-color: #ffffff; "><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">鎴戜滑鐭ラ亾錛屽湪鍏崇郴<a target="_self" style="word-break: break-all; text-decoration: underline; color: #000066; line-height: normal !important; "><u style="word-break: break-all; line-height: normal !important; "><strong style="word-break: break-all; line-height: normal !important; ">鏁版嵁搴?/strong></u></a>鏍囧噯涓湁鍥涗釜浜嬪姟闅旂綰у埆錛?/p><ul style="word-break: break-all; line-height: normal; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 3em; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; "><li style="word-break: break-all; line-height: normal; ">鏈彁浜よ(Read Uncommitted)錛氬厑璁歌剰璇伙紝涔熷氨鏄彲鑳借鍙栧埌鍏朵粬浼?xì)璇濅腑鏈彁浜や簨鍔′慨鏀圭殑鏁版?/li><li style="word-break: break-all; line-height: normal; ">鎻愪氦璇?Read Committed)錛氬彧鑳借鍙栧埌宸茬粡鎻愪氦鐨勬暟鎹侽racle絳夊鏁版暟鎹簱榛樿閮芥槸璇ョ駭鍒?/li><li style="word-break: break-all; line-height: normal; ">鍙噸澶嶈(Repeated Read)錛氬彲閲嶅璇匯傚湪鍚屼竴涓簨鍔″唴鐨勬煡璇㈤兘鏄簨鍔″紑濮嬫椂鍒諱竴鑷寸殑錛?strong style="word-break: break-all; line-height: normal; ">InnoDB榛樿綰у埆</strong>銆傚湪<a target="_self" style="word-break: break-all; text-decoration: underline; color: #000066; line-height: normal; padding-left: 0px; background-image: none; "><u style="word-break: break-all; line-height: normal; "><strong style="word-break: break-all; line-height: normal; ">SQL</strong></u></a>鏍囧噯涓紝璇ラ殧紱葷駭鍒秷闄や簡(jiǎn)涓嶅彲閲嶅璇伙紝浣嗘槸榪樺瓨鍦ㄥ夠璞¤</li><li style="word-break: break-all; line-height: normal; ">涓茶璇?Serializable)錛氬畬鍏ㄤ覆琛屽寲鐨勮錛屾瘡嬈¤閮介渶瑕佽幏寰楄〃綰у叡浜攣錛岃鍐欑浉浜掗兘浼?xì)闃诲?/li></ul><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">鏌ョ湅InnoDB緋葷粺綰у埆鐨勪簨鍔¢殧紱葷駭鍒細(xì)</p><div id="wmqeeuq" class="hl-surround" style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><div id="wmqeeuq" class="hl-main" style="word-break: break-all; line-height: normal !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">mysql> SELECT @@global.tx_isolation;<br style="word-break: break-all; line-height: normal !important; " />+-----------------------+<br style="word-break: break-all; line-height: normal !important; " />| @@global.tx_isolation |<br style="word-break: break-all; line-height: normal !important; " />+-----------------------+<br style="word-break: break-all; line-height: normal !important; " />| REPEATABLE-READ       |<br style="word-break: break-all; line-height: normal !important; " />+-----------------------+<br style="word-break: break-all; line-height: normal !important; " />1 row in set (0.00 sec)</div></div><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">鏌ョ湅InnoDB浼?xì)璇澗Uу埆鐨勪簨鍔¢殧紱葷駭鍒細(xì)</p><div id="wmqeeuq" class="hl-surround" style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><div id="wmqeeuq" class="hl-main" style="word-break: break-all; line-height: normal !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">mysql> SELECT @@tx_isolation;<br style="word-break: break-all; line-height: normal !important; " />+-----------------+<br style="word-break: break-all; line-height: normal !important; " />| @@tx_isolation  |<br style="word-break: break-all; line-height: normal !important; " />+-----------------+<br style="word-break: break-all; line-height: normal !important; " />| REPEATABLE-READ |<br style="word-break: break-all; line-height: normal !important; " />+-----------------+<br style="word-break: break-all; line-height: normal !important; " />1 row in set (0.00 sec)</div></div><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">淇敼浜嬪姟闅旂綰у埆錛?/p><div id="wmqeeuq" class="hl-surround" style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><div id="wmqeeuq" class="hl-main" style="word-break: break-all; line-height: normal !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">mysql> set global transaction isolation level read committed;<br style="word-break: break-all; line-height: normal !important; " />Query OK, 0 rows affected (0.00 sec)<br style="word-break: break-all; line-height: normal !important; " /><br style="word-break: break-all; line-height: normal !important; " />mysql> set session transaction isolation level read committed;<br style="word-break: break-all; line-height: normal !important; " />Query OK, 0 rows affected (0.00 sec)</div></div><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><span id="more-91" style="word-break: break-all; line-height: normal !important; "></span></p><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">InnoDB鐨勫彲閲嶅璇婚殧紱葷駭鍒拰鍏朵粬鏁版嵁搴撶殑鍙噸澶嶈鏄湁鍖哄埆鐨勶紝涓嶄細(xì)閫犳垚騫昏薄璇伙紙phantom read錛夛紝鎵璋撳夠璞¤錛屽氨鏄悓涓涓簨鍔″唴錛屽嬈elect錛屽彲浠ヨ鍙栧埌鍏朵粬session insert騫跺凡緇廲ommit鐨勬暟鎹備笅闈㈡槸涓涓皬鐨勬祴璇曪紝璇佹槑InnoDB鐨勫彲閲嶅璇婚殧紱葷駭鍒笉浼?xì)閫犳垚騫昏薄璇匯傛祴璇曟秹鍙?qiáng)涓や釜session錛屽垎鍒負(fù)session 1鍜宻ession 2錛岄殧紱葷駭鍒兘鏄痳epeateable read錛屽叧闂璦utocommit</p><div id="wmqeeuq" class="hl-surround" style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><div id="wmqeeuq" class="hl-main" style="word-break: break-all; line-height: normal !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">mysql> select @@tx_isolation;<br style="word-break: break-all; line-height: normal !important; " />+-----------------+<br style="word-break: break-all; line-height: normal !important; " />| @@tx_isolation  |<br style="word-break: break-all; line-height: normal !important; " />+-----------------+<br style="word-break: break-all; line-height: normal !important; " />| REPEATABLE-READ |<br style="word-break: break-all; line-height: normal !important; " />+-----------------+<br style="word-break: break-all; line-height: normal !important; " />1 row in set (0.00 sec)<br style="word-break: break-all; line-height: normal !important; " /><br style="word-break: break-all; line-height: normal !important; " />mysql> set autocommit=off;<br style="word-break: break-all; line-height: normal !important; " />Query OK, 0 rows affected (0.00 sec)</div></div><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">session 1 鍒涘緩琛ㄥ茍鎻掑叆嫻嬭瘯鏁版嵁</p><div id="wmqeeuq" class="hl-surround" style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><div id="wmqeeuq" class="hl-main" style="word-break: break-all; line-height: normal !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">mysql> create table test(i int) engine=innodb;<br style="word-break: break-all; line-height: normal !important; " />Query OK, 0 rows affected (0.00 sec)<br style="word-break: break-all; line-height: normal !important; " /><br style="word-break: break-all; line-height: normal !important; " />mysql> insert into test values(1);<br style="word-break: break-all; line-height: normal !important; " />Query OK, 1 row affected (0.00 sec)</div></div><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">session 2 鏌ヨ錛屾病鏈夋暟鎹紝姝e父錛宻ession1娌℃湁鎻愪氦錛屼笉鍏佽鑴忚</p><div id="wmqeeuq" class="hl-surround" style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><div id="wmqeeuq" class="hl-main" style="word-break: break-all; line-height: normal !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">mysql> select * from test;<br style="word-break: break-all; line-height: normal !important; " />Empty set (0.00 sec)</div></div><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">session 1 鎻愪氦浜嬪姟</p><div id="wmqeeuq" class="hl-surround" style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><div id="wmqeeuq" class="hl-main" style="word-break: break-all; line-height: normal !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">mysql> commit;<br style="word-break: break-all; line-height: normal !important; " />Query OK, 0 rows affected (0.00 sec)</div></div><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">session 2 鏌ヨ錛岃繕鏄病鏈夋暟鎹紝娌℃湁浜х敓騫昏薄璇?/p><div id="wmqeeuq" class="hl-surround" style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><div id="wmqeeuq" class="hl-main" style="word-break: break-all; line-height: normal !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">mysql> select * from test;<br style="word-break: break-all; line-height: normal !important; " />Empty set (0.00 sec)</div></div><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">浠ヤ笂璇曢獙鐗堟湰錛?/p><div id="wmqeeuq" class="hl-surround" style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; "><div id="wmqeeuq" class="hl-main" style="word-break: break-all; line-height: normal !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">mysql> select version();<br style="word-break: break-all; line-height: normal !important; " />+-------------------------+<br style="word-break: break-all; line-height: normal !important; " />| version()               |<br style="word-break: break-all; line-height: normal !important; " />+-------------------------+<br style="word-break: break-all; line-height: normal !important; " />| 5.0.37-community-nt-log |<br style="word-break: break-all; line-height: normal !important; " />+-------------------------+<br style="word-break: break-all; line-height: normal !important; " />1 row in set (0.00 sec)</div></div><p style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">--EOF--</p><div class="wmqeeuq" id="copyright" style="word-break: break-all; line-height: 1.8em !important; margin-top: 10px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; ">浣滆咃細(xì)<a title="姹熸灚 鍙戝竷" style="word-break: break-all; text-decoration: underline; color: #000066; line-height: normal !important; ">姹熸灚</a>| 銆愯漿杞芥椂璇峰姟蹇呬互瓚呴摼鎺ュ艦寮忔爣鏄庢枃绔犲師濮嬪嚭澶勫拰浣滆呬俊鎭強(qiáng)鏈0鏄庛?br style="word-break: break-all; line-height: normal !important; " />鍦板潃錛?a title="traceback" rel="trackback" style="word-break: break-all; text-decoration: underline; color: #000066; line-height: normal !important; ">http://rdc.taobao.com/blog/dba/html/91_mysql_innodb_transaction_isolation_level.html</a></div></span><img src ="http://www.aygfsteel.com/liangcmwn/aggbug/356601.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/liangcmwn/" target="_blank">liangcmwn</a> 2011-08-16 09:15 <a href="http://www.aygfsteel.com/liangcmwn/articles/356601.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Mysql甯哥敤鎿嶄綔http://www.aygfsteel.com/liangcmwn/articles/356576.htmlliangcmwnliangcmwnMon, 15 Aug 2011 08:50:00 GMThttp://www.aygfsteel.com/liangcmwn/articles/356576.htmlhttp://www.aygfsteel.com/liangcmwn/comments/356576.htmlhttp://www.aygfsteel.com/liangcmwn/articles/356576.html#Feedback0http://www.aygfsteel.com/liangcmwn/comments/commentRss/356576.htmlhttp://www.aygfsteel.com/liangcmwn/services/trackbacks/356576.html

鏌ョ湅MySQL鐨勫綋鍓嶅瓨鍌ㄥ紩鎿?/strong>

涓鑸儏鍐典笅錛宮ysql浼?xì)榛樿鎻愪緵澶毧U嶅瓨鍌ㄥ紩鎿?浣犲彲浠ラ氳繃涓嬮潰鐨勬煡鐪?

鐪嬩綘鐨刴ysql鐜板湪宸叉彁渚涗粈涔堝瓨鍌ㄥ紩鎿?
mysql> show engines;

鐪嬩綘鐨刴ysql褰撳墠榛樿鐨勫瓨鍌ㄥ紩鎿?
mysql> show variables like '%storage_engine%';

浣犺鐪嬫煇涓〃鐢ㄤ簡(jiǎn)浠涔堝紩鎿?鍦ㄦ樉紺虹粨鏋滈噷鍙傛暟engine鍚庨潰鐨勫氨琛ㄧず璇ヨ〃褰撳墠鐢ㄧ殑瀛樺偍寮曟搸):
mysql> show create table 琛ㄥ悕;

MySQL 涔辯爜鐨勬牴婧愭槸鐨?MySQL 瀛楃闆嗚緗笉褰撶殑闂錛屾湰鏂囨眹鎬諱簡(jiǎn)鏈夊叧鏌ョ湅 MySQL 瀛楃闆嗙殑鍛戒護(hù)銆傚寘鎷煡鐪?MySQL 鏁版嵁搴?/strong>鏈嶅姟鍣ㄥ瓧絎﹂泦銆佹煡鐪?MySQL 鏁版嵁搴撳瓧絎﹂泦錛屼互鍙?qiáng)鏁版嵁琛ㄥ拰瀛棇D電殑瀛楃闆嗐佸綋鍓?a target="_self" style="word-break: break-all; text-decoration: underline; color: #070648; line-height: normal !important; ">瀹夎鐨?MySQL 鎵鏀寔鐨勫瓧絎﹂泦絳夈?/p>

涓銆佹煡鐪?MySQL 鏁版嵁搴撴湇鍔″櫒鍜屾暟鎹簱瀛楃闆嗐?/p>

mysql> show variables like '%char%';
+--------------------------+-------------------------------------+------
| Variable_name            | Value                               |......
+--------------------------+-------------------------------------+------
| character_set_client     | utf8                                |......   -- 瀹㈡埛绔瓧絎﹂泦
| character_set_connection | utf8                                |......
| character_set_database   | utf8                                |......   -- 鏁版嵁搴撳瓧絎﹂泦
| character_set_filesystem | binary                              |......
| character_set_results    | utf8                                |......
| character_set_server     | utf8                                |......   -- 鏈嶅姟鍣ㄥ瓧絎﹂泦
| character_set_system     | utf8                                |......
| character_sets_dir       | D:\MySQL Server 5.0\share\charsets\ |......
+--------------------------+-------------------------------------+------

浜屻佹煡鐪?MySQL 鏁版嵁琛紙table錛?鐨勫瓧絎﹂泦銆?/p>

mysql> show table status from sqlstudy_db like '%countries%';
+-----------+--------+---------+------------+------+-----------------+------
| Name      | Engine | Version | Row_format | Rows | Collation       |......
+-----------+--------+---------+------------+------+-----------------+------
| countries | InnoDB |      10 | Compact    |   11 | utf8_general_ci |......
+-----------+--------+---------+------------+------+-----------------+------

涓夈佹煡鐪?MySQL 鏁版嵁鍒楋紙column錛夌殑瀛楃闆嗐?/p>

mysql> show full columns from countries;
+----------------------+-------------+-----------------+--------
| Field                | Type        | Collation       | .......
+----------------------+-------------+-----------------+--------
| countries_id         | int(11)     | NULL            | .......
| countries_name       | varchar(64) | utf8_general_ci | .......
| countries_iso_code_2 | char(2)     | utf8_general_ci | .......
| countries_iso_code_3 | char(3)     | utf8_general_ci | .......
| address_format_id    | int(11)     | NULL            | .......
+----------------------+-------------+-----------------+--------

鍥涖佹煡鐪嬪綋鍓嶅畨瑁呯殑 MySQL 鎵鏀寔鐨勫瓧絎﹂泦銆?/p>

mysql> show charset;
mysql> show char set;
+----------+-----------------------------+---------------------+--------+
| Charset  | Description                 | Default collation   | Maxlen |
+----------+-----------------------------+---------------------+--------+
| big5     | Big5 Traditional Chinese    | big5_chinese_ci     |      2 |
| dec8     | DEC West European           | dec8_swedish_ci     |      1 |
| cp850    | DOS West European           | cp850_general_ci    |      1 |
| hp8      | HP West European            | hp8_english_ci      |      1 |
| koi8r    | KOI8-R Relcom Russian       | koi8r_general_ci    |      1 |
| latin1   | cp1252 West European        | latin1_swedish_ci   |      1 |
| latin2   | ISO 8859-2 Central European | latin2_general_ci   |      1 |
| swe7     | 7bit Swedish                | swe7_swedish_ci     |      1 |
| ascii    | US ASCII                    | ascii_general_ci    |      1 |
| ujis     | EUC-JP Japanese             | ujis_japanese_ci    |      3 |
| sjis     | Shift-JIS Japanese          | sjis_japanese_ci    |      2 |
| hebrew   | ISO 8859-8 Hebrew           | hebrew_general_ci   |      1 |
| tis620   | TIS620 Thai                 | tis620_thai_ci      |      1 |
| euckr    | EUC-KR Korean               | euckr_korean_ci     |      2 |
| koi8u    | KOI8-U Ukrainian            | koi8u_general_ci    |      1 |
| gb2312   | GB2312 Simplified Chinese   | gb2312_chinese_ci   |      2 |
| greek    | ISO 8859-7 Greek            | greek_general_ci    |      1 |
| cp1250   | Windows Central European    | cp1250_general_ci   |      1 |
| gbk      | GBK Simplified Chinese      | gbk_chinese_ci      |      2 |
| latin5   | ISO 8859-9 Turkish          | latin5_turkish_ci   |      1 |
| armscii8 | ARMSCII-8 Armenian          | armscii8_general_ci |      1 |
| utf8     | UTF-8 Unicode               | utf8_general_ci     |      3 |
| ucs2     | UCS-2 Unicode               | ucs2_general_ci     |      2 |
| cp866    | DOS Russian                 | cp866_general_ci    |      1 |
| keybcs2  | DOS Kamenicky Czech-Slovak  | keybcs2_general_ci  |      1 |
| macce    | Mac Central European        | macce_general_ci    |      1 |
| macroman | Mac West European           | macroman_general_ci |      1 |
| cp852    | DOS Central European        | cp852_general_ci    |      1 |
| latin7   | ISO 8859-13 Baltic          | latin7_general_ci   |      1 |
| cp1251   | Windows Cyrillic            | cp1251_general_ci   |      1 |
| cp1256   | Windows Arabic              | cp1256_general_ci   |      1 |
| cp1257   | Windows Baltic              | cp1257_general_ci   |      1 |
| binary   | Binary pseudo charset       | binary              |      1 |
| geostd8  | GEOSTD8 Georgian            | geostd8_general_ci  |      1 |
| cp932    | SJIS for Windows Japanese   | cp932_japanese_ci   |      2 |
| eucjpms  | UJIS for Windows Japanese   | eucjpms_japanese_ci |      3 |
+----------+-----------------------------+---------------------+--------+

浠ヤ笂鏌ョ湅 MySQL 瀛楃闆嗗懡浠わ紝閫傜敤浜?Windows & Linux銆?/p>




liangcmwn 2011-08-15 16:50 鍙戣〃璇勮
]]>
mysql涓璴imit鐢ㄦ硶 http://www.aygfsteel.com/liangcmwn/articles/355164.htmlliangcmwnliangcmwnWed, 27 Jul 2011 09:10:00 GMThttp://www.aygfsteel.com/liangcmwn/articles/355164.html

      浣跨敤鏌ヨ璇彞鐨勬椂鍊欙紝緇忓父瑕佽繑鍥炲墠鍑犳潯鎴栬呬腑闂存煇鍑犺鏁版嵁錛岃繖涓椂鍊欐庝箞鍔炲憿錛熶笉鐢ㄦ媴蹇冿紝mysql宸?緇忎負(fù)鎴戜滑鎻愪緵浜?jiǎn)杩欐牱涓涓姛鑳姐?/p>

SELECT * FROM table   LIMIT [offset,] rows | rows OFFSET offset


      LIMIT 瀛愬彞鍙互琚敤浜庡己鍒?SELECT 璇彞榪斿洖鎸囧畾鐨勮褰曟暟銆侺IMIT 鎺ュ彈涓涓垨涓や釜鏁板瓧鍙傛暟銆傚弬鏁板繀欏繪槸涓涓暣鏁板父閲忋傚鏋滅粰瀹氫袱涓弬鏁幫紝絎竴涓弬鏁版寚瀹氱涓涓繑鍥炶褰曡鐨勫亸縐婚噺錛岀浜屼釜鍙傛暟鎸囧畾榪斿洖璁板綍琛岀殑鏈澶ф暟鐩傚垵 濮嬭褰曡鐨勫亸縐婚噺鏄?0(鑰屼笉鏄?1)錛?涓轟簡(jiǎn)涓?PostgreSQL 鍏煎錛孧ySQL 涔熸敮鎸佸彞娉曪細(xì) LIMIT # OFFSET #銆?/p>

mysql> SELECT * FROM table LIMIT 5,10;  // 媯(gè)绱㈣褰曡 6-15

//涓轟簡(jiǎn)媯(gè)绱粠鏌愪竴涓亸縐婚噺鍒拌褰曢泦鐨勭粨鏉熸墍鏈夌殑璁板綍琛岋紝鍙互鎸囧畾絎簩涓弬鏁頒負(fù) -1錛?
mysql
> SELECT * FROM table LIMIT 95,-1; // 媯(gè)绱㈣褰曡 96-last.

//濡傛灉鍙粰瀹氫竴涓弬鏁幫紝瀹冭〃紺鴻繑鍥炴渶澶х殑璁板綍琛屾暟鐩細(xì)
mysql
> SELECT * FROM table LIMIT 5;     //媯(gè)绱㈠墠 5 涓褰曡

//鎹㈠彞璇濊錛孡IMIT n 絳変環(huán)浜?LIMIT 0,n銆?/span>

瀹炰緥錛?/strong>

mysql> use sppeivan;
Database changed
mysql> select * from employee; // 榪斿洖鎵鏈夌粨鏋?/strong>
+------------+------------+--------+-------------+
| username   | password   | gender | cellphone   |
+------------+------------+--------+-------------+
| ewrew      | erewr      | MAN    | 13618889076 |
| ewrwerw32r | 324324     | MAN    | 13618889076 |
| grrrrr     | r44343     | WOMAN | 13618889076 |
| pansong    | erewrwe    | MAN    | 13618889076 |
| ret43t43t | 43t43      | MAN    | 13618889076 |
| ret44t4    | r4tgr      | WOMAN | 13618889076 |
| tttt       | 4et        | WOMAN | 13618889076 |
| wr34r      | retre      | MAN    | 13618889076 |
| xxx     | safe       | MAN    | 13618889076 |
| hhh       | ewrwer     | MAN    | 13618889076 |
| hg       | 6574326543 | MAN    | 13618889076 |
| ps       | ewrwe      | MAN    | 13618889076 |
| zhu       | werew      | MAN    | 13618889076 |
+------------+------------+--------+-------------+
13 rows in set (0.01 sec)

mysql> select * from employee limit 3 7;
ERROR 1064 (42000): You have an error in your SQL syntax
corresponds to your MySQL server version for the right s
line 1
mysql> select * from employee limit 3, 7; // 榪斿洖4-11琛?/strong>
+-----------+----------+--------+-------------+
| username | password | gender | cellphone   |
+-----------+----------+--------+-------------+
| pansong   | erewrwe | MAN    | 13618889076 |
| ret43t43t | 43t43    | MAN    | 13618889076 |
| ret44t4   | r4tgr    | WOMAN | 13618889076 |
| tttt      | 4et      | WOMAN | 13618889076 |
| wr34r     | retre    | MAN    | 13618889076 |
| xxx     | safe     | MAN    | 13618889076 |
| hhh      | ewrwer   | MAN    | 13618889076 |
+-----------+----------+--------+-------------+
7 rows in set (0.00 sec)

mysql> select * from employee limit 3,-1; // 閿欒璇硶
ERROR 1064 (42000): You have an error in your SQL syntax
corresponds to your MySQL server version for the right s
t line 1


mysql> select * from employee limit 3,1; // 榪斿洖絎?琛?/strong>
+----------+----------+--------+-------------+
| username | password | gender | cellphone   |
+----------+----------+--------+-------------+
| pansong | erewrwe | MAN    | 13618889076|
+----------+----------+--------+-------------+
1 row in set (0.00 sec)

mysql> select * from employee limit 3; // 榪斿洖鍓?琛?/strong>

+------------+----------+--------+-------------+
| username   | password | gender | cellphone   |
+------------+----------+--------+-------------+
| ewrew      | erewr    | MAN    | 13618889076 |
| ewrwerw32r | 324324   | MAN    | 13618889076 |
| grrrrr     | r44343   | WOMAN | 13618889076 |
+------------+----------+--------+-------------+
3 rows in set (0.00 sec)


mysql> select * from employee limit 10; // 榪斿洖鍓?0琛?/strong>

+------------+----------+--------+-------------+
| username   | password | gender | cellphone   |
+------------+----------+--------+-------------+
| ewrew      | erewr    | MAN    | 13618889076 |
| ewrwerw32r | 324324   | MAN    | 13618889076 |
| grrrrr     | r44343   | WOMAN | 13618889076 |
| pansong    | erewrwe | MAN    | 13618889076 |
| ret43t43t | 43t43    | MAN    | 13618889076 |
| ret44t4    | r4tgr    | WOMAN | 13618889076 |
| tttt       | 4et      | WOMAN | 13618889076 |
| wr34r      | retre    | MAN    | 13618889076 |
| xxx     | safe     | MAN    | 13811588469 |
| hhh       | ewrwer   | MAN    | 13618889076 |
+------------+----------+--------+-------------+
10 rows in set (0.00 sec)

mysql> select * from employee limit 9,1; // 榪斿洖絎?0琛?/strong>

+----------+----------+--------+-------------+
| username | password | gender | cellphone   |
+----------+----------+--------+-------------+
| hhh     | ewrwer   | MAN    | 13816668468 |
+----------+----------+--------+-------------+
1 row in set (0.00 sec)



liangcmwn 2011-07-27 17:10 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 五家渠市| 自贡市| 麻栗坡县| 察哈| 安福县| 二手房| 来凤县| 汉阴县| 扎兰屯市| 张家港市| 桐城市| 新巴尔虎右旗| 清徐县| 策勒县| 武定县| 凤庆县| 台山市| 彭泽县| 济阳县| 阳曲县| 舟曲县| 钦州市| 诸城市| 勐海县| 海阳市| 永平县| 高邑县| 南川市| 锡林郭勒盟| 磴口县| 玉林市| 隆子县| 斗六市| 图们市| 陆良县| 阳东县| 沙坪坝区| 林周县| 黔江区| 桓台县| 贵州省|