MySQLÊý¾Ýµ¼Èëµ¼³öcsvÎļþÃüÁî
MySqlÊý¾Ý¿âµ¼³öcsvÎļþÃüÁ
mysql> select first_name,last_name,email from account into outfile 'e:\\output1.csv' fields terminated by ','optionally enclosed by ''lines terminated by '\n';
csvÎļþЧ¹û£º
sunny
Grigoryan
lovechoosesun@gmail.com
Jon
Siegal
sun@riliantech.net
Joe
Siegal
zhao@gmail.com
alejandro
medina
wei@gmail.com
cvsÎļþµ¼ÈëMySqlÊý¾Ý¿âÃüÁî:
mysql> load data local infile 'e:\\input1.csv' into table test1 fields termin
ated by ','lines terminated by '\n'(first_name,last_name,email);
Query OK, 1 row affected, 1 warning (0.00 sec)
Records: 69 Deleted: 0 Skipped: 68 Warnings: 0
mysql> select * from test1;
+----+------------+-----------+--------------------------+
| id | first_name | last_name | email |
+----+------------+-----------+--------------------------+
| 0 | sunny | Grigoryan | lovechoosesun@gmail.com
+----+------------+-----------+--------------------------+
FIELDS TERMINATED BY ---- ×Ö¶ÎÖÕÖ¹×Ö·û
OPTIONALLY ENCLOSED BY ---- ·âÌ×·û
LINES TERMINATED BY ---- ÐÐÖÕÖ¹·û
Ïà¹ØÎĵµ£º
ΪÁËÓ¦ÓÃϵͳµÄ¿ÉÉìËõÐÔ£¬ÍùÍùÐèÒª¶ÔÊý¾Ý¿â½øÐÐscale outÉè¼Æ£¬scale outÉè¼ÆÒ²¾ÍÊÇͨ¹ýÔö¼ÓÊý¾Ý¿â´¦Àí½ÚµãÀ´Ìá¸ßϵͳÕûÌåµÄ´¦ÀíÄÜÁ¦£¬¼´Ôö¼ÓÊý¾Ý¿â·þÎñÆ÷µÄÊýÁ¿À´·Öµ£Ñ¹Á¦¡£Í¨¹ýÕâÖÖ·½Ê½ÏµÍ³µÄÉìËõÐÔÔöÇ¿ÁË£¬³É±¾Ò²½µµÍÁË£¬µ«ÊÇϵͳµÄ¼Ü¹¹¸ºÔðÁË£¬Î¬»¤À§ÄÑÁË¡£ÄÑÃâ³öÏÖϵͳµÄå´»ú»ò¹ÊÕÏ¡£Òò´Ë£¬ÀíÂÛÉÏÀ´Ëµ£¬ÏµÍ³µÄ°²È«ÐÔ£¨ ......
MySQL+PHP²úÉúÂÒÂëÔÒò£º
¡ô MySQLÊý¾Ý¿âĬÈϵıàÂëÊÇutf8,Èç¹ûÕâÖÖ±àÂëÓëÄãµÄPHPÍøÒ³²»Ò»ÖÂ,¿ÉÄܾͻáÔì³ÉMySQLÂÒÂ룻
¡ô MySQLÖд´½¨±íʱ»áÈÃÄãÑ¡ÔñÒ»ÖÖ±àÂë,Èç¹ûÕâÖÖ±àÂëÓëÄãµÄÍøÒ³±àÂë²»Ò»ÖÂ,Ò²¿ÉÄÜÔì³ÉMySQLÂÒÂ룻
¡ô MySQL´´½¨±íʱÌí¼Ó×Ö¶ÎÊÇ¿ÉÒÔÑ¡Ôñ±àÂëµÄ,Èç¹ûÕâÖÖ±àÂëÓëÄãµÄÍøÒ³±àÂë²»Ò»ÖÂ,Ò²¿ÉÄÜÔì³ÉMySQ ......
µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ÓÈëÒ»¸ö²ÎÊý-h»úÆ÷IP
µ ......
Ö÷´ÓģʽµÄÌØÐÔ¾ÍÊÇһ̨·þÎñÆ÷×÷ΪÖ÷·þÎñÆ÷£¬ÆäÓà·þÎñÆ÷×÷Ϊ´Ó·þÎñÆ÷£¬Ö÷·þÎñÆ÷½ÓÊÕÔöɾ¸Ä²éµÄ²Ù×÷£¬´Ó·þÎñÆ÷Ö»ÄܽÓÊÕ²éµÄ²Ù×÷¡£
Ö÷·þÎñÆ÷½«Êý¾Ý¸üÐÂÖÁ´Ó·þÎñÆ÷ÊÇÒì²½µÄ£¬Òì²½µÄÓŵãÊÇ¿ÉÒÔÔÚ·þÎñÆ÷¿ÕÏÐÆÚ¼ä½øÐÐͬ²½£¬¶ø²»±ØÕ¼ÓýôȱµÄ×ÊÔ´£¬È±µã¾ÍÊÇ´Ó·þÎñÆ÷µÄÊý¾ÝºÜ¿ÉÄܲ»ÊÇ×îеġ£
Ö»ÄÜÓ¦ÓÃÓÚ¶ÔÊý¾Ýͬ²½ÒªÇ󲻸ߵij¡ºÏ ......