#IMPORT SQL FILE TO TABLE
Login to mysql database first then run below script:
source namefile.sql
or from logout of mysql
mysql -u root -p DBName < NameofImportTable.sql
#EXPORT TABLE TO SQL FORMAT
exit from mysql sql first then run below script:
mysqldump -u root -p DBname TableName > NameofExportTableFile.sql
Thursday, July 18, 2019
LOAD MANY TEXT FILE TO MYSQL TABLE
#01.5 the script executed from out of mysql with run file coba.bat
All file: bat file & txt file stored in folder c:\xampp\mysql\bin
echo on
setlocal enabledelayedexpansion
FOR %%f IN ("*.txt") DO (
mysql -e "LOAD DATA local INFILE '"%%f"' INTO TABLE tabelname FIELDS TERMINATED BY '|' LINES TERMINATED BY '\r\n'" -u root --password=password DBname
DONE
)
All file: bat file & txt file stored in folder c:\xampp\mysql\bin
echo on
setlocal enabledelayedexpansion
FOR %%f IN ("*.txt") DO (
mysql -e "LOAD DATA local INFILE '"%%f"' INTO TABLE tabelname FIELDS TERMINATED BY '|' LINES TERMINATED BY '\r\n'" -u root --password=password DBname
DONE
)
Labels:
Mysql
Subscribe to:
Posts (Atom)