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?
1 Answer
To backup/save databases as SQL files, run
mysqldump -uroot -p database_name > dumpfilename.sqlReplace
database_namewith the name of the database you want to copy over and enter the root password when asked.Copy the
dumpfilename.sqlfile over to the other system like any other regular file and import the database using this command:mysql -uroot -p database_name < dumpfilename.sqlAgain, replace
database_namewith 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.