开发者

Copying MySQL database from test server to local MAMP server

开发者 https://www.devze.com 2023-04-06 04:07 出处:网络
I may have gone completely braindead today, but I\'m having trouble copying my DB down to my local MAMP server. I\'m not too familiar with mysqldump, etc, but I want to know how to copy a database fro

I may have gone completely braindead today, but I'm having trouble copying my DB down to my local MAMP server. I'm not too familiar with mysqldump, etc, but I want to know how to copy a database from a test server to my MAMP local server in the开发者_开发技巧 easiest way possible. I have very limited experience with server stuff, but have a bit of experience with command line.

Any straight-forward help would be much appreciated. I look forward to smacking myself in the head when I realise what a dick I've been ;)

Dalogi


mysqldump's the best way:

on the test server: mysqldump -p name_of_db > dump.sql
on the map server: mysql -p < dump.sql

The dump file contains the full instructions in SQL query format to recreating the db, it stable structure, and data. The -p option forces both apps to prompt for your password. If your MySQL username is different than your system's login account, then you'll need the -u option as well:

mysqldump -p -u yourDBusername name_of_db > dump.sql
mysql -p -u yourDBusername < dump.sql


mysqldump -h 'remotehost' -uremoteuser -premotepass db_name | mysql -ulocaluser -plocalpass db_name
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号