To transfer a MySQL database from one server to another on a UNIX or Linux system, you can use the following steps:
mysqldump
command to create a backup of the database. This will create a file containing the SQL statements needed to recreate the database and its contents. For example:mysqldump -u username -p database_name > database_name.sql
Replace "username" with your MySQL username and "database_name" with the name of the database you want to transfer. You will be prompted to enter your password when you run the command.
scp
to securely copy the file from the source server to the destination server. For example:scp database_name.sql username@destination_server:/path/to/destination
mysql
command-line tool. For example:mysql -u username -p
Enter your password when prompted. Then, run the following command to create a new database:
CREATE DATABASE database_name;
mysql
command to import the data from the SQL file into the new database. For example:mysql -u username -p database_name < database_name.sql
Enter your password when prompted. This will execute the SQL statements in the file and recreate the database and its contents on the destination server.
Note: These steps assume that you have access to the MySQL server on both the source and destination servers and that you have the necessary permissions to create and modify databases.