Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to transfer my MySQL database to another computer?

Tags:

mysql

xampp

I am using XAMPP package in my own desktop with Window 7 as OS.

That means I'm using MySQL DB and Apache server.

Now I would like to copy/migrate my whole MySQL DB to my friend's desktop, which is also with Window as OS, and also using XAMPP package.

Is there any way for me to do that?

like image 888
dannail Avatar asked Mar 25 '12 12:03

dannail


2 Answers

Copy database files from MySQL folder (under old xampp folder) except share,bin, and script folder see attached image to see which files need copy (only files with in green box) and replace all these database files in new installed xampp directory in MySQL folder.

Restart xampp start MySQL and open database and table to make sure its working.

Files to replace in green lines

like image 190
A.Aleem11 Avatar answered Nov 15 '22 03:11

A.Aleem11


Yes. You can use the command line tool mysqldump

Saving your database

mysqldump -u[yourusername] -p[yourpassword] --all-databases > mydump.sql

Reading it back in:

mysql -u[yourusername] -p[yourpassword] < mydump.sql

I'm assuming the mysql bin directory is accessible via command line. [yourusername] and [yourpassword] should be written without the brackets.

like image 10
ma cılay Avatar answered Nov 15 '22 04:11

ma cılay