Æô¶¯mysqlµÄ·þÎñ¾³£·¢ÏÖ1067Õâ¸ö´íÎ󡣲鿴ʼþÈÕÖ¾ÒÔºó·¢ÏÖÏÂÃæµÄ´íÎóÐÅÏ¢
Unknown/unsupported table type: INNODB
ÈçºÎ½â¾ö£ºÔÚmysqlÊý¾Ý´æ·ÅĿ¼ÏÂÕÒµ½ ibdata ÒÔ¼°ib_logfile0¡¢ib_logfile1ɾµôÔÙÆô¶¯¾ÍºÃÁË ......
°æȨÉùÃ÷
£º×ªÔØʱÇëÒÔ³¬Á´½ÓÐÎʽ±êÃ÷ÎÄÕÂÔʼ³ö´¦ºÍ×÷ÕßÐÅÏ¢¼°±¾ÉùÃ÷
http://bbayou.blogbus.com/logs/37045617.html
²âÊÔÊý¾Ý2.5G£¬¹²ÓÐÊý¾Ý9427567Ìõ¡£ÓõÄmysqlµÄlarge·þÎñÆ÷µÄÅäÖá£
load
Ò»´ÎÐèÒª´ó¸Å10·ÖÖÓ×óÓÒ¡£
½¨µÄ±íÓõÄÊÇMYISAM£¬µ÷ÕûÁ˼¸¸ösessionµÄ²ÎÊýÖµ
SET
SESSION
BULK_INSERT_BUFFER_SIZE
=
256217728
;
SET
SESSION
MYISAM_SORT_BUFFER_SIZE
=
256217728
;
ÔËÐнá¹ûÈçÏÂ
Query OK, 9427567 rows affected, 1558 warnings (3 min 55.21 sec)
Records: 9427567 Deleted: 0 Skipped: 0 Warnings: 0
googleµ½µÄ»¹¿ÉÒÔ
set
global
KEY_BUFFER_SIZE
=
256217728
;
alter
table
tablename
disable
keys
;
ÈçºÎload
Êý¾ÝÀïÃæ´ø·´Ð±¸Ü(backslash)”\” µÄÊý¾Ý
ÓÉÓÚÈç¹ûÄãûÓÐÖ¸¶¨FIELDS×Ӿ䣬ÔòĬÈÏֵΪ¼ÙÉèÄúдÏÂÈçÏÂÓï¾äʱµÄÖµ£º
FIELDS TERMINATED BY ‘\t’ ENCLOSED BY ” ESCAPED BY ‘\\’
ËùÒÔ£¬Èç¹ûÄãµÄÊý¾ÝÀïÃæÓз´Ð±¸Ü(backslash)”\”µÄʱºò£¬Êý¾Ý»á³öÏÖ±»½Ø¶ÏµÄÎÊÌâ¡£³öÏÖÕâÖÖÎÊÌ⣬ֻҪдÉÏÈçϵÄfields×Ӿ伴¿É
FIELDS ......
1¡¢MySQLÊÇÓÐһЩ»·¾³±äÁ¿¿ÉÒÔÉèÖã¬
¿ÉÊäÈ룺show variables;¿É²é¿´µ±Ç°µÄ»·¾³±äÁ¿ÉèÖã»
2¡¢ÕâЩ±äÁ¿µ±ÖÐÓÐÒ»²¿·ÖÓë×Ö·ûÏà¹ØµÄÉèÖã¬
¿ÉÊäÈ룺show variables like ´character%´;²é¿´£»
3¡¢ÆäÖÐcharacter_set_results¾ö¶¨·µ»Ø½á¹ûµÄ±àÂ룬
windowsÏÂÉèΪgb2312¼´¿ÉÕý³£ÏÔʾÖÐÎÄ£»
ÉèÖ÷½·¨£ºset character_set_results=gb2312;£¬È»ºó»Ø³µ¼´¿É£»
4¡¢µ±È»£¬Èç¹ûÏëͨ¹ýÃüÁîÌáʾÐд°¿ÚÀ´ÊäÈëÖÐÎÄÐÞ¸ÄÊý¾Ý¿âÄÚÈÝ£¬
Ôò¿ÉÒÔÊÔÊÔÉèÖÃset character_set_connection=gb2312;
ÒÔ¼°set character_set_client=gb2312;
˵Ã÷£º
ÒÔÉÏÔÚÃüÁîÌáʾÐд°¿ÚÖÐÉèÖõÄÖµ£¬
ÆäÓÐЧÆÚ½ö½öΪ±¾´ÎÁ¬½ÓÓÐЧ£¬
¼´¶Ï¿ª±¾´ÎÁ¬½ÓÖ®ºó£¬
ÖØÐÂÁ¬½Ó½øÀ´£¬
ËùÓÐËùÉèÖõıäÁ¿ÓÖ»Ö¸´µ½Ä¬ÈϵÄÖµÁË¡£ ......
ת×Ôhttp://www.linuxbyte.org/yi-ge-mysql-server-shang-de-xiao-ji-qiao.html
ÔÚmy.cnf µÄ mysql ¶Ë Ìí¼ÓÈçÏÂÉèÖÃ
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
prompt="(\u:mysql1@linuxbyte.org \R:\m)[\d]: "
»á²úÉúÈçÏÂЧ¹û:
root@ubuntu:/home/hew# mysql -u hew -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 320
Server version: 5.1.41-3ubuntu12.1 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
(hew:mysql1@linuxbyte.org 21:12)[(none)]: use linuxbyte #×¢ÒâÕâÀï
Database changed
(hew:mysql1@linuxbyte.org 21:13)[linuxbyte]: use linuxsky; #͉˕
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
(hew:mysql1@linuxbyte.org 21:13)[linuxsky]: #͉˕
ÈçÉÏËùʾÎÒÃÇ¿ÉÒÔÔÚmysqlÃüÁîÐÐÏÂÏÔʾµ±Ç°µÄmysql Óû§£¬ËùÔÚÖ÷»ú£¬Ê±¼äºÍËùÓõÄÊý¾Ý¿â¡ ......
MySQLÈÕÆÚ×ֶηÖDateºÍTimeÁ½ÖÖ£¬oracleÈÕÆÚ×Ö¶ÎÖ»ÓÐDate£¬°üº¬ÄêÔÂÈÕʱ·ÖÃëÐÅÏ¢£¬Óõ±Ç°Êý¾Ý¿âµÄϵͳʱ¼äΪsysdate,¾«È·µ½Ã룬»òÕßÓÃ×Ö·û´®×ª»»ÈÕÆÚÐͺ¯Êý£º
To_date('2001-08-01','YYYY-MM-DD'); Äê-ÔÂ-ÈÕ
24Сʱ£º·ÖÖÓ£ºÃëµÄ¸ñʽ 'YYYY-MM-DD HH24:MI:SS'
MYSQL:
º¯Êý
¹¦ÄÜ
CURDATE()
·µ»Øµ±Ç°ÈÕÆÚ
CURTIEME()
·µ»Øµ±Ç°Ê±¼ä
NOW()
·µ»Øµ±Ç°Ê±¼äºÍÈÕÆÚ
UNIX_TIMESTAMP(date)
·µ»ØÈÕÆÚºÍUnixʱ¼ä´Á
from_UNIXTIME(datetime)
·µ»ØUnixʱ¼ä´ÁºÍÈÕÆÚÖµ
WEEK(date)
·µ»ØÈÕÆÚdateΪһÄêÖеڼ¸ÖÜ
YEAR(date)
·µ»ØÈÕÆÚdateµÄÄê·Ý
HOUR(time)
·µ»ØtimeµÄСʱֵ
MINUTE(time)
·µ»ØtimeµÄ·ÖÖÓÖµ
MONTHNAME(date)
·µ»ØdateµÄÔ·ÝÃû
DATE_FORMAT(date,fmt)
·µ»Ø°´×Ö·û´®fmtºÍ¸ñʽ»¯ÈÕÆÚdateÖµ
DATE_ADD(date,INTERVAL e ......
MySQLÈÕÆÚ×ֶηÖDateºÍTimeÁ½ÖÖ£¬oracleÈÕÆÚ×Ö¶ÎÖ»ÓÐDate£¬°üº¬ÄêÔÂÈÕʱ·ÖÃëÐÅÏ¢£¬Óõ±Ç°Êý¾Ý¿âµÄϵͳʱ¼äΪsysdate,¾«È·µ½Ã룬»òÕßÓÃ×Ö·û´®×ª»»ÈÕÆÚÐͺ¯Êý£º
To_date('2001-08-01','YYYY-MM-DD'); Äê-ÔÂ-ÈÕ
24Сʱ£º·ÖÖÓ£ºÃëµÄ¸ñʽ 'YYYY-MM-DD HH24:MI:SS'
MYSQL:
º¯Êý
¹¦ÄÜ
CURDATE()
·µ»Øµ±Ç°ÈÕÆÚ
CURTIEME()
·µ»Øµ±Ç°Ê±¼ä
NOW()
·µ»Øµ±Ç°Ê±¼äºÍÈÕÆÚ
UNIX_TIMESTAMP(date)
·µ»ØÈÕÆÚºÍUnixʱ¼ä´Á
from_UNIXTIME(datetime)
·µ»ØUnixʱ¼ä´ÁºÍÈÕÆÚÖµ
WEEK(date)
·µ»ØÈÕÆÚdateΪһÄêÖеڼ¸ÖÜ
YEAR(date)
·µ»ØÈÕÆÚdateµÄÄê·Ý
HOUR(time)
·µ»ØtimeµÄСʱֵ
MINUTE(time)
·µ»ØtimeµÄ·ÖÖÓÖµ
MONTHNAME(date)
·µ»ØdateµÄÔ·ÝÃû
DATE_FORMAT(date,fmt)
·µ»Ø°´×Ö·û´®fmtºÍ¸ñʽ»¯ÈÕÆÚdateÖµ
DATE_ADD(date,INTERVAL e ......
MySQLÖеÄÁ÷³Ìº¯Êý
º¯Êý
¹¦ÄÜ
IF(value,t ,f)
Èç¹ûvalueΪÕ棬·µ»Øt£¬·ñÔò·µ»Øf
IFNULL(value1,value2)
Èç¹ûvalue1²»Îª¿Õ·µ»Øvalue1,·ñÔò·µ»Øvalue2
CASE WHEN [value1] THEN [result1] … ELSE [default] END
Èç¹ûvalue1ΪÕæ ·µ»Øresult2 ·ñÔò·µ»Ødefault
CASE [expr] WHEN [value1] THEN [result1] … ELSE [default] END
Èç¹ûexprµÈÓÚvalue1,·µ»Øresult1,·ñÔò·µ»Ødefault
......