MySQL Database Backup: Windows to Linux Machine
Step 1: Open command prompt in administrator mode on Windows machine. Navigate to the path bin directory where MySQL was installed.
e.g. cd C:\Program Files\MySQL\MySQL Server 5.6\bin
Step 2: Once in that directory, execute the following command.
mysqldump.exe -u <Username> -p <database_name> > <Backup_directory>\applicare.sql
e.g.
mysqldump.exe -u root -p applicare > C:\Applicare_DB_Backup\applicare.sql
Step 3: After running the command, MySQL will prompt you for a password, Enter the password and wait few minutes for the process to complete.
After executing the command, verify that there is SQL file named applicare.sql in backup directory.
Step 4: Using PuTTY, log in to the machine where MySQL is running. Execute the following command to connect MySQL database. After running the command, enter the MySQL in the password when prompt.
mysql -u<Mysql-DB_user_name> -p
e.g.
mysql -uroot -p
Step 5: Run the following command on the Linux machine to create a new database with the same name as the one backed up from the windows MySQL server.
CREATE DATABASE applicare;
USE applicare;
Step 6: Run the following command to import the exported MySQL SQL file.
source <File_Directory>/applicare.sql
e.g.
source /home/applicare.sql
Command to export a specific table data from windows to Linux machine.
mysqldump.exe -u <Username> -p <database_name> <table_name> > <Backup_directory>\applicare_tbl_server.sql
e.g.
mysqldump.exe -u root -p applicare server > C:\Applicare_DB_Backup\applicare_tbl_server.sql
Comments
0 comments
Article is closed for comments.