MySQL學習的一些認識筆記

來源:互聯網
上載者:User

MySQL也是分用戶端和伺服器兩部分安裝,當裝好MySQL伺服器和用戶端之後就面臨資料庫中的表,資料庫中表的結構之間的匯入和匯出問題,現在用過的一些SQL命令:

>MySQL -u busiusr -p 進入MySQL資料庫

>set names gbk ;

MySQLdump -uroot newdrmdb tacts >tacts.sql 把庫newdrmdb中的表tacts的資料匯出;

source 絕對路徑/*.sql 把資料匯入到表中去 ;

MySQL -uroot -pheli098 < ...(絕對路徑); 在linux中執行資料庫的指令碼 ;

select * from tmonthfees limit 1000 into outfile '/*.csv' fields terminated by ', ' ; 從tmonthfees表中匯出1000條記 錄到檔案中 ;
load data local infile ' ' into table table_name fields terminated by ',' ; 把檔案中的資料匯入到表中去;

delete from tmonthfees;
delete from tusers;
delete from tusersongs;
delete from tsubscribers;

load data local infile 'C:/sql/tmonthfees.13911629339.txt' into table tmonthfees fields terminated by ',';
load data local infile 'C:/sql/tusers.13911629339.txt' into table tusers fields terminated by ',';
load data local infile 'C:/sql/tusersongs.13911629339.txt' into table tusersongs fields terminated by ',';
load data local infile 'C:/sql/tsubscribers.13911629339.txt' into table tsubscribers fields terminated by ',';

匯入文字檔中的資料到資料庫中的表; 

相關文章

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.