經常需要將mysql資料庫中的資料匯出到excel表格,或者需要將excel表格資料匯入到mysql資料庫,我的方法是先將它們都轉換成一種中間資料格式csv(execl資料可以直接匯出為csv格式,csv格式也可以直接用excel開啟)。下面介紹一下操作步驟:csv匯入mysqlload data infile "C:\\Users\\UserName\\Desktop\\test.csv" into table `table` fields terminated by "," optionally enclosed by """ escaped by """ lines terminated by "\n"; mysql匯入csvselect * from `table`load data infile "C:\\Users\\UserName\\Desktop\\test.csv" fields terminated by "," optionally enclosed by """ escaped by """ lines terminated by "\n"; 如果亂碼,可用相關編輯器開啟.csv檔案,另存為utf-8的csv
經常需要將mysql資料庫中的資料匯出到excel表格,或者需要將excel表格資料匯入到mysql資料庫,我的方法是先將它們都轉換成一種中間資料格式csv(execl資料可以直接匯出為csv格式,csv格式也可以直接用excel開啟)。下面介紹一下操作步驟:csv匯入mysqlload data infile "C:\\Users\\UserName\\Desktop\\test.csv" into table `table` fields terminated by "," optionally enclosed by """ escaped by """ lines terminated by "\n"; mysql匯入csvselect * from `table`load data infile "C:\\Users\\UserName\\Desktop\\test.csv" fields terminated by "," optionally enclosed by """ escaped by """ lines terminated by "\n"; 如果亂碼,可用相關編輯器開啟.csv檔案,另存為utf-8的csv