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 ---- ÐÐÖÕÖ¹·û
Ïà¹ØÎĵµ£º
²éѯ¼°É¾³ýÖظ´¼Ç¼µÄ·½·¨
(Ò»)
1¡¢²éÕÒ±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´ÅжÏ
select * from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
2¡¢É¾³ý±íÖжàÓàµÄÖظ´¼Ç¼£¬Öظ´¼Ç¼ÊǸù¾Ýµ¥¸ö×ֶΣ¨peopleId£©À´Åжϣ¬Ö»ÁôÓÐrowid ......
µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ÓÈëÒ»¸ö²ÎÊý-h»úÆ÷IP
µ ......
½«SQLÓï¾ä·Åµ½Ò»¸öÎļþÖÐÈ»ºó¸æËßmysql´Ó¸ÃÎļþ¶ÁÈ¡ÊäÈ룬eg£º
shell>mysql db_name < text_file
Èç¹ûÕýÔÚÔËÐÐmysql£¬¿ÉÒÔʹÓÃ"source"»ò"\."ÃüÁîÖ´ÐÐSQL½Å±¾Îļþ£º
mysql>source filename
mysql>\. filename
ÀýÈ磬ҪÔÚÊý¾Ý¿âtestÖд´½¨±íºÍ²åÈëÊý¾Ý£¬ÆäÖд´½¨±íºÍ²åÈëÊý¾ÝµÄSQLÓï ......
1)
°²×°Apache/2.2.14 ºÍ PHP/5.2.12 Ö®ºó£¬ÖØÐÂÆô¶¯Apache£¬Æô¶¯Ê§°Ü¡£²éÁËһЩ×ÊÁÏ£¬»ù±¾Éϸø³öµÄ½¨ÒéÊǽûµôExtension¡£ÎÒ¾Í×°ÁËÒ»¸öExtesion Mysqli¡£
ÐÞ¸Äphp.ini ×¢Ê͵ôÕâÒ»ÐУ¬¹ûÈ»ÉúЧ¡£
[PHP_MYSQLI]
;extension=php_mysqli.dll
°²×°Íêmysql£¬ÔÙÖØÐÂenableÕâ¸öÅäÖþͺÃÁË£¬¹À¼ÆÊÇÒÀÀµÄ³Ð©mysqlµÄ¿â¡£
......