Connecting Tech Pros Worldwide Forums | Help | Site Map

exporting & importing database

Member
 
Join Date: Feb 2008
Posts: 35
#1: Feb 9 '08
i am doing the programming at home and our teacher checks it in school that's why i need to export/import my database.. but i dont know how..
i've found this instruction on the net but i cant understand

1. Export A MySQL Database
This example shows you how to export a database. It is a good idea to export your data often as a backup.

# mysqldump -u username -ppassword database_name > FILE.sql

Replace username, password and database_name with your MySQL username, password and database name.

File FILE.sql now holds a backup of your database, download it to your computer.

2. Import A MySQL Database

Here, we import a database. Use this to restore data from a backup or to import from another MySQL server.

Start by uploading the FILE.sql file to the server where you will be running this command.

# mysql -u username -ppassword database_name < FILE.sql

Replace the parts in red with your own information.

This powerful, easy to use command has many uses. Let's say you wanted to switch web hosting providers.

Simply export your data on the old provider's server and import it on your account with the new host.


in #1 it says that i have to download "FILE.sql" to my computer.. but the problem is i dont know where will i find "FILE.sql"

Member
 
Join Date: Dec 2006
Location: Pune
Posts: 50
#2: Feb 9 '08

re: exporting & importing database


Give th efull path of the local machine and directory insteed of the File.sql gives the C:\mydata\filename.sql
Member
 
Join Date: Feb 2008
Posts: 35
#3: Feb 10 '08

re: exporting & importing database


Quote:

Originally Posted by sandeepsandeep

Give th efull path of the local machine and directory insteed of the File.sql gives the C:\mydata\filename.sql

what do you mean by "local machine"? i cant understand what you're instructing me.. kindly explain further
ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,440
#4: Feb 10 '08

re: exporting & importing database


Quote:

Originally Posted by mirianCalin

what do you mean by "local machine"? i cant understand what you're instructing me.. kindly explain further

Mirian, you haven't tell us about the operating system that you are using. What sandeepsandeep is saying actually if you are using a windows machine (Local Machine == Your PC), set the full path to save the file.
Expand|Select|Wrap|Line Numbers
  1. mysqldump -u<username> -p database_name >  /path/to/filename.sql
hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#5: Feb 10 '08

re: exporting & importing database


Quote:

Originally Posted by mirianCalin

i am doing the programming at home and our teacher checks it in school that's why i need to export/import my database.. but i dont know how..
i've found this instruction on the net but i cant understand

1. Export A MySQL Database
This example shows you how to export a database. It is a good idea to export your data often as a backup.

# mysqldump -u username -ppassword database_name > FILE.sql

Replace username, password and database_name with your MySQL username, password and database name.

File FILE.sql now holds a backup of your database, download it to your computer.

2. Import A MySQL Database

Here, we import a database. Use this to restore data from a backup or to import from another MySQL server.

Start by uploading the FILE.sql file to the server where you will be running this command.

# mysql -u username -ppassword database_name < FILE.sql

Replace the parts in red with your own information.

This powerful, easy to use command has many uses. Let's say you wanted to switch web hosting providers.

Simply export your data on the old provider's server and import it on your account with the new host.


in #1 it says that i have to download "FILE.sql" to my computer.. but the problem is i dont know where will i find "FILE.sql"


There is one simple solution for your problem....
Use HEIDI SQL (free download)

http://www.heidisql.com/

Just a button will do the whole job..

(Open both the connections in different Heidi SQL window and then click on the export button in the one whom you want to export.)
ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,440
#6: Feb 10 '08

re: exporting & importing database


Quote:

Originally Posted by hsriat

There is one simple solution for your problem....
Use HEIDI SQL (free download)

http://www.heidisql.com/

Just a button will do the whole job..

(Open both the connections in different Heidi SQL window and then click on the export button in the one whom you want to export.)

Why not MySQL GUI tools And phpMyAdmin
hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#7: Feb 10 '08

re: exporting & importing database


Quote:

Originally Posted by ak1dnar

Why not MySQL GUI tools And phpMyAdmin


ummm...
Actually I exported my database using heidiSQL, and I found it easy to use than phpMyAdmin.

I haven't used used My SQL GUI tools..., but this migration tool seems to be interesting...
Reply


Similar PHP bytes