user4194060
user4194060

Reputation:

How to Transfer MySQL Data From Raspberry Pi to my PC

I've started using Raspberry Pi few days back. I need to transfer a database from my Raspberry Pi to my PC.

I've installed MySQL on the Raspberry Pi and put some data in the database. I've already installed MySQL on my PC. I need to transfer data from the MySQL database on the Raspberry Pi to another MySQL on the PC.

Is this possible through LAN....? Or is there another technique to transfer the data from the Raspberry Pi to the PC?

Is there any technique to transfer directly from one MySQL to another MySQL?

Upvotes: 0

Views: 2137

Answers (3)

Xenotoad
Xenotoad

Reputation: 362

Use mysqldump to output a file containing a bunch of SQL queries that can rebuild your database and then run those queries on your PC database like so:

pi$ mysqldump -u username -p > mysql.dump

pi$ mysql -u username -p --host=<your pc's ip> < mysql.dump

Upvotes: 2

fancyPants
fancyPants

Reputation: 51928

Instead of copying the file(s), you can pipe the output directly to the remote database.

pi_shell> mysqldump -uuser -ppassword --single-transaction database_name | mysql -uuser -ppassword -hremote_mysql_db database_name

Upvotes: 1

candy.cloud.nimbus
candy.cloud.nimbus

Reputation: 135

Back up the database on the pi, copy the file on the other computer then restore it on your computer.

Please see this site for reference

Upvotes: 0

Related Questions