mysql limit ·ÖÒ³
Rubicon
LIMIT×Ó¾ä¿ÉÒÔ±»ÓÃÀ´ÏÞÖÆSELECTÓï¾ä·µ»ØµÄÐÐÊý¡£LIMITÈ¡1¸ö»ò2¸öÊý×Ö²ÎÊý£¬Èç¹û¸ø¶¨2¸ö²ÎÊý£¬µÚÒ»¸öÖ¸¶¨Òª·µ»ØµÄµÚÒ»ÐеÄÆ«ÒÆÁ¿£¬µÚ¶þ¸öÖ¸¶¨·µ»ØÐеÄ×î´óÊýÄ¿¡£³õʼÐеÄÆ«ÒÆÁ¿ÊÇ0(²»ÊÇ1)¡£ mysql> select * from table LIMIT 5,10; # Retrieve rows 6-15 Èç¹û¸ø¶¨Ò»¸ö²ÎÊý£¬ËüÖ¸³ö·µ»ØÐеÄ×î´óÊýÄ¿¡£ mysql> select * from table LIMIT 5; # Retrieve first 5 rows »»¾ä»°Ëµ£¬LIMIT nµÈ¼ÛÓÚLIMIT 0,n¡£ getInteger(String nm) È·¶¨¾ßÓÐÖ¸¶¨Ãû³ÆµÄϵͳÊôÐÔµÄÕûÊýÖµ¡£ parseInt(String s) ½«×Ö·û´®²ÎÊý×÷ΪÓзûºÅµÄÊ®½øÖÆÕûÊý½øÐзÖÎö¡£ ËùÒÔתÊý×ÖʱÓÃÏÂÃæÕâÑù¡£ÓÃÉÏÃæÕâ¸ö³ö´í¡£
String sPageNow=req.getParameter("wpageNow");
pw.println("spageNow:"+sPageNow);
if(sPageNow!=null){
pageNow=Integer.parseInt(sPageNow);
}
if(pageNow>0){
temp=(pageNow-1)*pageCount;
sql="select * from work limit "+temp+","+pageCount;
pw.println(sql);
rs=con.getRs(st, sql);
}
Ïà¹ØÎĵµ£º
1.ÐÞ¸ÄmysqlµÄĬÈϱàÂëΪgbk£ºÐÞ¸Ämy.initÎļþÖеģº[client]ºÍ[mysqld]ϵÄdefault-character-set=gbk£»
2.²é¿´mysqlÊý¾Ý¿âµÄ±àÂ룺show variable like 'character%';»òstatus
3.²é¿´Êý¾Ý¿â±íµÄ±àÂ룺show create table ±íÃû£»
4.ÐÞ¸ÄÊý¾Ý¿âµÄ±àÂ룺ALTER DATABASE `database_name` DEFAULT CHARACTER SET gbk COLLATE ......
´ÓAÖ÷»úµ¼ÈëÊý¾Ýµ½BÖ÷»ú
mysqldump -hA -uusername -ppassword db_name >dumpfile
mysql -hB -uusername -ppassword
mysql>create database db_name2;
mysql>use db_name2;
mysql>source dumpfile;
ÏÈÓÃdump°ÑAÖеÄÊý¾Ý¿âdb_nameµ¼Èëµ½Îļþdumpfile£¬È»ºóÔÚBÖ÷»úÉÏ£¬´´½¨Ò»¸öеÄÊý¾Ý¿âdb_name2£¬Ê¹Óà ......
ÔÎĵØÖ·£ºhttp://blog.csdn.net/wenjava/archive/2009/06/11/4261299.aspx
ÔÚʹÓÃMySQL֮ǰ£¬ÐèÒª½¨Á¢Êý¾Ý¿âµÄ»·¾³À´´´½¨Êý¾Ý±í£¬Ê×ÏÈÎÒÃÇÐèÒª°²×°¸ÃÊý¾Ý¿â»·¾³£¬¼´MySQL¡£
1¡¢ÏÂÔØMySQL
MySQLµÄ¹Ù·½ÍøÕ¾ÊÇhttp://www.mysql.org/£¬Èçͼ2-9Ëùʾ£º
ͼ2-9 MySQL¹Ù·½ÍøÕ¾
µ±Ç°Îȶ¨°æ±¾Îª5.1£¬ÎÒÃÇÑ¡ÓÃMySQL 5.1.22× ......
1.¼ì²éÒÔÇ°°²×°µÄMySQL,жÔØ¡£
rpm -qa|grep -i mysql
rpm -e XXXXX
×¢Èç¹û³öÏÖÁ½ÌõÏàͬµÄ£¬ÔòʹÓÃrpm -e --allmatches
2.°²×°rpm°ü¡£
rpm -ivh MySQL-server-community-5.1.37-0.rhel5.x86_64.rpm
rpm -ivh MySQL-shared-community-5.1.37-0.rhel5.x86_64.rpm
rpm -ivh MySQL-devel-community-5.1.37-0.rhel5.x86_6 ......
½â¾ö·½·¨£º
1¡£ ¸Ä±í·¨¡£¿ÉÄÜÊÇÄãµÄÕʺŲ»ÔÊÐí´ÓÔ¶³ÌµÇ½£¬Ö»ÄÜÔÚlocalhost¡£Õâ¸öʱºòÖ»ÒªÔÚlocalhostµÄÄÇ̨µçÄÔ£¬µÇÈëmysqlºó£¬¸ü¸Ä "mysql" Êý¾Ý¿âÀïµÄ "user" ±íÀïµÄ "host" Ï´Ó"localhost"¸Ä³Æ"%"
mysql -u root -pvmwaremysql>use mysql;
mysql>update ......