How to migrate local mysql to server database

How to migrate local mysql to server database

We can use the scp command of Linux (scp cannot be used in Windows), plus mysqldump that comes with mysql, to quickly complete the database migration.

Export the local database (music_db) as a sql file (music_db.sql)

mysqldump -uroot -p music_db > music_db.sql

Use the scp command to send the sql file to the server

scp music_db.sql remote login account@server ip:server directory/music_db.sql

SSH login server

ssh remote login account@remote ip

Log in to mysql on the server

mysql -uroot -p

Create a database with the same name (music_db) in the server's mysql, and then exit mysql

create database music_db charset=utf8;

exit;

Import the music_db.sql file transferred by the scp command into the database of the same name just created
mysql -uroot -p music_db < music_db.sql

Finish

Some students may ask if there is a simpler way. Don’t tell me there is! ! !

Method 2

The premise is that you have used Navicat to connect to the remote server. . . . .

For methods to connect to a remote server, see another blog: Remote connection to a server database

After connecting to the server, you can see the server database. We can right-click on the local data or server database, and the following will appear:

After selecting Data Transfer, you can see the following:

Just fill in the local and server related information to be transferred, click Start to display the log information, and wait for the upload to be completed!

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Implementation of mysql8.0.11 data directory migration
  • How to migrate the data directory in mysql8.0.20
  • Analysis of the principle of MySQL large table extraction mode from the perspective of cloud data migration service
  • Detailed explanation of MySQL event modification events (ALTER EVENT), disabling events (DISABLE), enabling events (ENABLE), event renaming and database event migration operations
  • Upgrade Docker version of MySQL 5.7 to MySQL 8.0.13, data migration
  • Detailed explanation of how to migrate a MySQL database to another machine
  • MySQL database migration quickly exports and imports large amounts of data
  • Python makes mysql data migration script
  • Summary of MySQL data migration

<<:  JavaScript to implement the countdown for sending SMS

>>:  Alibaba Cloud Server Tomcat cannot be accessed

Recommend

A simple method to regularly delete expired data records in MySQL

1. After connecting and logging in to MySQL, firs...

MySQL5.7.27-winx64 version win10 download and installation tutorial diagram

MySQL 5.7 installation We are learning MySQL data...

Debian virtual machine created by VirtualBox shares files with Windows host

the term: 1. VM: Virtual Machine step: 1. Downloa...

Detailed explanation of how to use awk in Linux

Before learning awk, we should have learned sed, ...

The use and methods of async and await in JavaScript

async function and await keyword in JS function h...

About Vue's 4 auxiliary functions of Vuex

Table of contents 1. Auxiliary functions 2. Examp...

Summary of ten Linux command aliases that can improve efficiency

Preface Engineers working in the Linux environmen...

Eight rules for effective web forms

If you're collecting information from your us...

Detailed explanation of how to migrate a MySQL database to another machine

1. First find the Data file on the migration serv...

Introduction to document.activeELement focus element in JavaScript

Table of contents 1. The default focus is on the ...

In-depth understanding of asynchronous waiting in Javascript

In this article, we’ll explore how async/await is...

MySQL optimization strategy (recommended)

In summary: 1. Consider performance when designin...