Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I installed a LAMP server on my pc and created databases. Now I want to copy it to my friend's computer. How can I do this?

share|improve this question

1 Answer 1

up vote 7 down vote accepted
  1. To backup/save databases as SQL files, run

    mysqldump -uroot -p database_name > dumpfilename.sql
    

    Replace database_name with the name of the database you want to copy over and enter the root password when asked.

  2. Copy the dumpfilename.sql file over to the other system like any other regular file and import the database using this command:

    mysql -uroot -p database_name < dumpfilename.sql
    

    Again, replace database_name with the (new) name of the database and enter the root password when asked.

Note that this is totally not OS-specific, but a general way of dumping/importing MySQL databases.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.