简体   繁体   中英

import multiple files together into xampp mysql database

How can I import multiple files(.csv, .sql etc) into xampp mysql database ?

I am using Xampp and windows XP.

If I need to write command prompt type command, please tell in details where to find the command prompt type screen and so on.

The SQL files you can execute with MySQL command-line tool , eg -

shell> mysql db_name < script.sql

Load data from the CSV file into specified table you can with LOAD DATA INFILE statement.

If you do not have access to mysql client, then try dbForge Studio for MySQL . Free express edition allows to execute SQL scripts and import data from the CSV file without limitations.

This topic has been covered already, in its parts.

  1. to import a CSV you can check this question , which will lead you to use:

LOAD DATA INFILE yourfile.csv

or if you need to update some data that is already on the database you can relate to a question I answered not long ago (and possibly other answers on stackoverflow).

You may execute this statement in the mysql prompt with mysql -u user -p -h localhost -D database (learn how to find the path to mysql.exe in your XAMMP using this question ) or using some other way, such as your scripting/programming language of choice together with mysql connectors/libraries.

You may also use the mysqlimport.exe command (it'll be in the same folder as your mysql binary).

  1. To import a sql file you can take a look at this question . You will essentially just copy the file contents into the mysql prompt, which is usually done with input redirection on the console:

C:>mysql -u user -p -h localhost -D database -o < yoursqlfile.sql

I hope that besides answering your question i might also have introduced you to the fact that with thousands(?) of questions in stackoverflow you are very likely to find the answers to your doubts by searching the questions database, possibly faster than asking your own new question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM