The below example shows how to import data into mysql database using mysqlimport utility. We are importing data from a text file to mysql database.
mysqlimport utility is a stand-alone command line utility program which comes with MySQL.
First you have to connect to mysql server.
1. open command prompt
2. change directory to the path of mysql bin folder (for example C:\xampp\mysql\bin)
1. open command prompt
2. change directory to the path of mysql bin folder (for example C:\xampp\mysql\bin)
Create a database employee and use that database.
create a table employee with 2 fields id and name
create a text file for employee table with fields delimited by tab.This file is used for importing data into employee table.
employee.txt
1 Tom
2 pinky
3 Ram
1 Tom
2 pinky
3 Ram
put the employee.txt file into C:\xampp\mysql\data\employee folder.
In mysqlimport, the name of the data file should match the name of the table.
close the mysql connection by typing exit
open a new command prompt and change directory to the path of mysql bin folder (for example C:\xampp\mysql\bin)
Type mysqlimport command
This will import the employee details from the text file into employee table.
nice tutorials
ReplyDeleteactually i have a database of SMS and i want to export please write some program for it
ReplyDelete