How to transfer MySQL database from Windows to Ubuntu?
6,265
mysqldump is the general method to copy a database over.
Create a dump on windows:
mysqldump -u [USER] -p [DATABASE] > [BACKUP]
Copy the file over to Ubuntu and restore it in Ubuntu:
mysql -u [USER] -p [DATABASE] <./[BACKUP]
- both commands are done from the shell (not from within MySQL).
Related videos on Youtube
Author by
MahmoudSenSei
Updated on September 18, 2022Comments
-
MahmoudSenSei over 1 year
I want to transfer my database from WAMP on my local machine to my Ubuntu VPS.
Can I just copy the folder of the database from
C:\wamp\bin\mysql\mysql5.6.12\data
to/var/lib/mysql
?-
Rinzwind about 10 yearsEhm I would dump the databases and load them.
-
-
MahmoudSenSei about 10 yearsthx but i have this error "mysqldump is not recognized as an internal or external command"
-
NGRhodes about 10 yearsYou need to change directory to where you run mysql from.
-
Rinzwind about 10 years@MahmoudSenSei sorry I am not a windows user. you are on your own ;)
-
MahmoudSenSei about 10 yearsThx i just found the solution, i searched for mysqldump in Wamp and copied it in c:\windows\system32
-
MahmoudSenSei about 10 years@Rinzwind last thing , should i create an ampty database in the server to dump in it my new database ?
-
Rinzwind about 10 yearsYes. A dump does not make the db itself (you also need permissions to it ;) )
-
MahmoudSenSei about 10 years@Rinzwind permissions ?
-
MahmoudSenSei about 10 yearsu mean the user should have all privileges ?
-
Rinzwind about 10 yearspermissions as in GRANT PRIVILEGES etc.
-
Sanal S over 5 yearswhat if mysql crashed and won't start on windows. how can i transfer database from windows to ubuntu in such case?