excel表格的資料匯入MYSQL方法

來源:互聯網
上載者:User

 

excel表格的資料匯入MYSQL方法

 

前置條件    

1.        

excel資料正確,資料庫中表格建立完成。例如:

excel表中有欄位 id,findtime,name,summary,種類,category,detail,affected_system,attack_scenarios,ease_of_attack,sms,mms,sp,xdown_software,sig_sid,correct_action,17個指段。那麼在資料庫中建立如下表格:

DROP TABLE IF EXISTS `virus_signature`;

CREATE TABLE `virus_signature` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `findtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

  `name` varchar(255) NOT NULL,

  `summary` varchar(100) NOT NULL,

  `category` int(11) unsigned NOT NULL DEFAULT '0',

  `detail` text NOT NULL,

  `affected_system` varchar(200) NOT NULL,

  `attack_scenarios` text NOT NULL,

  `ease_of_attack` varchar(30) NOT NULL,

  `sms` int(10) unsigned NOT NULL,

  `mms` int(10) unsigned NOT NULL,

  `sp_number` int(10) unsigned NOT NULL,

  `xdown_software` int(10) unsigned NOT NULL,

  `sig_sid` int(10) unsigned NOT NULL,

  `correct_action` varchar(200) NOT NULL,

  PRIMARY KEY (`id`)

) ENGINE=MyISAM AUTO_INCREMENT=711 DEFAULT CHARSET=utf8;

 

 

2.         假設virus_signature.xls 路徑是: c:/virus_signature.xls;

假設資料庫資訊如下:

主機:192.168.4.82,

usename: root ,

password: 123456,

database:perseus,

table: virus_signature.

 

匯入方法    

1.         本地安裝“Navicat for MySQL” 公司ftp上有破解版。          

 

2.         用Navicat for MySQL串連   perseus資料庫。

 

3.         在“Navicat for MySQL”中選中perseus庫中的“表” --> 右擊滑鼠 --> 選中“匯入嚮導” --> 選中“Excel檔案”後點擊下一步 --> 匯入從c:/virus_signature.xls--> 選中virus_signature 表名後點下一步 --> 根據需要輸入選項卡中的項,這裡“第一欄” 輸入“2”後點擊下一步 --> 直接下一步 --> 檢查“目標欄位”與“源欄位”是否對應,對應後點擊下一步 -->  根據需要選中選項卡中的項後下一步 -->
開始 --> 查看運行結果是否沒有錯誤

匯出方法

在192.168.4.28機器上運行如下:

mysqldump –uroot –p123456 perseus virus_signature > virus_signature.sql

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.