SQL 檔案匯入資料庫

2022-09-07 07:12:08 字數 919 閱讀 7699

1、首先通過 xshell 連線資料庫伺服器,執行命令 mysql -u root -p 命令,按照提示輸入密碼,連線上資料庫

2、在連線終端上執行命令 create database jd_model;

3、將準備好的資料庫檔案 t_user.sql 檔案通過 xftp 工具,上傳至 /root 目錄下,並等待上傳完畢

4、在連線資料庫的終端執行命令 use jd_model,使用 jd_model 資料庫

5、先通過準備好的建立表結構 sql,執行 sql 建立表結構

6、執行命令 source /root/t_user.sql,執行資料庫匯入命令,待匯入完畢,執行下一步操作

7、確定資料表是否建立成功,即資料檔案是否匯入成功,執行命令 show tables;檢視資料庫下的表

8、最終通過工具檢視表資料

sql檔案資料匯入資料庫

1.建立createsql.sql檔案,內容 drop table if exists t user create table t user user id int 11 not null auto increment,user name char 30 not null,user password...

將csv檔案匯入sql資料庫

有乙個csv檔案需要匯入到sql資料庫中,其格式為 adb dds sdf adb dds sdf 先在sql資料庫中建乙個表,結構與csv檔案相同 將資料,時間等都定義成nvarchar,否則出現錯誤 然後執行 bulk insert order from c abc.csv with field...

資料庫中匯出 匯入 sql資料庫檔案

mysql 的bin 路徑需要在系統路徑中 如果沒在環境變數中新增bin路徑,則這裡要在cmd命令中直接進入bin根目錄下。1.將資料庫mydb 匯出到e mysql mydb.sql 檔案中 開啟開始 執行 輸入cmd 進入命令列模式 c mysql bin mysqldump h localho...