[ת]MySQLÊý¾Ý¿âµÄÊý¾Ý±¸·ÝºÍ»Ö¸´Ïê½â
ת:http://home.mysql.cn/space-51084-do-blog-id-43.html
±¾ÎÄÌÖÂÛ MySQL
µÄ±¸·ÝºÍ»Ö¸´»úÖÆ£¬ÒÔ¼°ÈçºÎά»¤Êý¾Ý±í£¬°üÀ¨×îÖ÷ÒªµÄÁ½ÖÖ±íÀàÐÍ£ºMyISAM ºÍ Innodb£¬ÎÄÖÐÉè¼ÆµÄ MySQL °æ±¾Îª 5.0.22¡£
Ä¿Ç° MySQL
Ö§³ÖµÄÃâ·Ñ±¸·Ý¹¤¾ßÓУºmysqldump¡¢mysqlhotcopy£¬»¹¿ÉÒÔÓà SQL Óï·¨½øÐб¸·Ý£ºBACKUP TABLE »òÕß SELECT
INTO OUTFILE£¬ÓÖ»òÕß±¸·Ý¶þ½øÖÆÈÕÖ¾£¨binlog£©£¬»¹¿ÉÒÔÊÇÖ±½Ó¿½±´Êý¾ÝÎļþºÍÏà¹ØµÄÅäÖÃÎļþ¡£MyISAM
±íÊDZ£´æ³ÉÎļþµÄÐÎʽ£¬Òò´ËÏà¶Ô±È½ÏÈÝÒ×±¸·Ý£¬ÉÏÃæÌáµ½µÄ¼¸ÖÖ·½·¨¶¼¿ÉÒÔʹÓá£Innodb ËùÓÐµÄ±í¶¼±£´æÔÚͬһ¸öÊý¾ÝÎļþ ibdata1
ÖУ¨Ò²¿ÉÄÜÊǶà¸öÎļþ£¬»òÕßÊǶÀÁ¢µÄ±í¿Õ¼äÎļþ£©£¬Ïà¶ÔÀ´Ëµ±È½Ï²»ºÃ±¸·Ý£¬Ãâ·ÑµÄ·½°¸¿ÉÒÔÊÇ¿½±´Êý¾ÝÎļþ¡¢±¸·Ý binlog£¬»òÕßÓÃ
mysqldump¡£
1¡¢mysqldump
1.1 ±¸·Ý
mysqldump ÊDzÉÓÃSQL¼¶±ðµÄ±¸·Ý»úÖÆ£¬Ëü½«Êý¾Ý±íµ¼³É SQL
½Å±¾Îļþ£¬ÔÚ²»Í¬µÄ MySQL °æ±¾Ö®¼äÉý¼¶Ê±Ïà¶Ô±È½ÏºÏÊÊ£¬ÕâÒ²ÊÇ×î³£Óõı¸·Ý·½·¨¡£ÏÖÔÚÀ´½²Ò»Ï mysqldump µÄһЩÖ÷Òª²ÎÊý£º
--compatible=name Ëü¸æËß
mysqldump£¬µ¼³öµÄÊý¾Ý½«ºÍÄÄÖÖÊý¾Ý¿â»òÄĸö¾É°æ±¾µÄ MySQL ·þÎñÆ÷Ïà¼æÈÝ¡£Öµ¿ÉÒÔΪ
ansi¡¢mysql323¡¢mysql40¡¢postgresql¡¢oracle¡¢mssql¡¢db2¡¢maxdb¡¢no_key_options¡¢
no_tables_options¡¢no_field_options
µÈ£¬ÒªÊ¹Óü¸¸öÖµ£¬ÓöººÅ½«ËüÃǸô¿ª¡£µ±È»ÁË£¬Ëü²¢²»±£Ö¤ÄÜÍêÈ«¼æÈÝ£¬¶øÊǾ¡Á¿¼æÈÝ¡£
--complete-insert£¬-c µ¼³öµÄÊý¾Ý²ÉÓðüº¬×Ö¶ÎÃûµÄÍêÕû
INSERT ·½Ê½£¬Ò²¾ÍÊÇ°ÑËùÓеÄÖµ¶¼Ð´ÔÚÒ»ÐС£Õâô×öÄÜÌá¸ß²åÈëЧÂÊ£¬µ«ÊÇ¿ÉÄÜ»áÊܵ½ max_allowed_packet
²ÎÊýµÄÓ°Ïì¶øµ¼Ö²åÈëʧ°Ü¡£Òò´Ë£¬ÐèÒª½÷É÷ʹÓøòÎÊý£¬ÖÁÉÙÎÒ²»ÍƼö¡£
--default-character-set=charset
Ö¸¶¨µ¼³öÊý¾Ýʱ²ÉÓúÎÖÖ×Ö·û¼¯£¬Èç¹ûÊý¾Ý±í²»ÊDzÉÓÃĬÈ쵀 latin1 ×Ö·û¼¯µÄ»°£¬ÄÇôµ¼³öʱ±ØÐëÖ¸¶¨¸ÃÑ¡Ï·ñÔòÔٴε¼ÈëÊý¾Ýºó½«²úÉúÂÒÂëÎÊÌâ¡£
--disable-keys ¸æËß mysqldump ÔÚ INSERT
Óï¾äµÄ¿ªÍ·ºÍ½áβÔö¼Ó /*!40000 ALTER TABLE table DISABLE KEYS */; ºÍ /*!40000 ALTER
TABLE table ENABLE KEYS */; Óï¾ä£¬ÕâÄÜ´ó´óÌá¸ß²åÈëÓï¾äµÄËٶȣ¬ÒòΪËüÊÇÔÚ²åÈëÍêËùÓÐÊý¾Ýºó²ÅÖؽ¨Ë÷ÒýµÄ¡£¸ÃÑ¡ÏîÖ»ÊʺÏ
MyISAM 񡭜
--extended-insert = true|false
ĬÈÏÇé¿öÏ£¬mysqldump ¿ªÆô --complete-insert ģʽ£¬Òò´Ë²»ÏëÓÃËüµÄµÄ»°£¬¾ÍʹÓñ¾Ñ¡ÏÉ趨ËüµÄֵΪ false
¼´¿É¡£
--hex-blob
ʹÓÃÊ®Áù½øÖƸñʽµ¼
Ïà¹ØÎĵµ£º
ÓÒ¼üÎҵĵçÄÔ->ÊôÐÔ->¸ß¼¶->»·¾³±äÁ¿
¿ÉÒÔ¿´µ½ÓÐÓû§±äÁ¿ºÍϵͳ±äÁ¿
ÔÚÕâÀïÎÒÃÇ¿ÉÒÔ½øÐÐÐ޸Ļ·¾³±äÁ¿
±ÈÈç˵ÎÒÃÇ°²×°ÁËMySQL·þÎñÆ÷£¬Ïë½øÈëMySQLµÄÃüÁîÐеĻ°¾Í±ØÐëÔËÐÐcmd
Èç¹ûûÓÐÉèÖû·¾³±äÁ¿µÄ»°ÎÒÃDZØÐë½øÈëMySQLµÄ°²×°Â·¾¶²ÅÄÜʹÓÃmysql -u root -pÕâ¸öÃüÁî
ÕâÑù»á¸øÎÒÃÇ´øÀ´ºÜ¶àÂé·³£¬ÕâʱºòÎÒÃÇÏëÔ ......
¶ÔÓÚÿ¸öÀàÐÍÓµÓеÄÖµ·¶Î§ÒÔ¼°²¢ÇÒÖ¸¶¨ÈÕÆÚºÎʱ¼äÖµµÄÓÐЧ¸ñʽµÄÃèÊö¼û7.3.6 ÈÕÆÚºÍʱ¼äÀàÐÍ¡£
ÕâÀïÊÇÒ»¸öʹÓÃÈÕÆÚº¯ÊýµÄÀý×Ó¡£ÏÂÃæµÄ²éѯѡÔñÁËËùÓмǼ£¬Æädate_colµÄÖµÊÇÔÚ×îºó30ÌìÒÔÄÚ£º
mysql> SELECT something from table
WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) select DAYOFWEEK('1998-02-03');
-&g ......
mysqlÍ£Ö¹ÃüÁî
bin/mysqladmin -uroot -p shutdown
mysqlÆô¶¯ÃüÁî
bin/mysqld_safe &
mysql ÐÞ¸ÄrootÃÜÂë
1.Í£Ö¹mysql·þÎñ
2.Æô¶¯mysql·þÎñʱ¸½¼Ó²ÎÊý
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
3.ÒÔroot½øÈëmysql
mysql -u root mysql
4.Ö´ÐÐsqlÓï¾ä
mysql> UPDATE user S ......
2009-05-05
´ò¿ªMySQLÔ¶³Ì·ÃÎÊȨÏÞ
¹Ø¼ü×Ö: mysql
1¡¢¸Ä±í·¨
¡¡¡¡¿ÉÄÜÊÇÄãµÄÕʺŲ»ÔÊÐí´ÓÔ¶³ÌµÇ½£¬Ö»ÄÜÔÚlocalhost¡£Õâ¸öʱºòÖ»ÒªÔÚlocalhostµÄÄÇ̨µçÄÔ£¬µÇÈëmysqlºó£¬¸ü¸Ä "mysql" Êý¾Ý¿âÀïµÄ "user" ±íÀïµÄ "host" Ï´Ó"localhost"¸Ä³Æ"%"
¡¡¡¡mysql -u root -p
mysql>use mysql;
¡¡¡¡mysql>upda ......
MySQL error 2003µÄ½â¾ö¹ý³Ì¸Õ²ÅÂÛ̳³öÏÖ:
error 2003:Can't connect to MySQL server on ..............
ÎÊÌâ:MYSQLÊý¾Ý¿âûÓÐÆô¶¯~
½â¾ö:°Ù¶ÈÁËÒ»ÏÂ,˵µÄ½â¾ö·½·¨¸÷ÖÖ¸÷Ñù,ºÜ¶à.
1\ÔÚ“ÔËÐДÀïÕÒµ½C:\mysql\bin\mysqld-opt.exe ÔËÐоÍÊÇÁË£¡ÕÒÁË,ûÓÐÕâ¸ö¶«Î÷:(
2 ÔÚDosÏÂ cd \mysql ......