- Forums
- MySQL
- How To Import And Export Mysql Database From Old Server To New Server
This Page Contains information about How To Import And Export Mysql Database From Old Server To New Server By wallpaperama in category MySQL with 0 Replies. [894], Last Updated: Sat May 18, 2024
wallpaperama
Sun Mar 23, 2008
0 Comments
1080 Visits
i use this command to make mysqldump from the old server
mysqldump -h localhost -u [MySQL user, e.g. root] -p[database password] -c --add-drop-table --add-locks --all --quick --lock-tables [name of the database] > sqldump.sql
and i use this command to dump the data into the new server
mysql -h localhost -u [MySQL user, e.g. root] -p[database password] [name of the database] < [name of your sql dump, e.g. sqldump.sql]
so using the above i can give you and example.
user: root
password: mypass
dbname: mydata
name of sql dump: mydump.sql
NEW SERVER:
mysqldump -h localhost -u root -pmypass -c --add-drop-table --add-locks --all --quick --lock-tables mydata > mydump.sql
OLD SERVER:
mysql -h localhost -u root -pmypass mydata < mydump.sql
done