Reputation:
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
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
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
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