將數據導入數據庫

將/etc/passwd 中需要的內容輸出到 /tmp/passwd中

  awk -F ':' '{print $1, $3, $4, $6, $7}' /etc/passwd > /tmp/passwd
創建表 passwd create table passwd (name char(10),uid int,gid int,home char(30),bash char(20));
導入數據load data infile '/tmp/passwd' into table passwd fields terminated by " ";
 
若出現

出現ERROR 13 (HY000): Can't get stat of '/tmp/passwd' (Errcode: 13) 表示當前導入數據的文件所在的目錄權限不夠 該爲777就可以了

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章