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

js to achieve floor scrolling effect

This article uses jQuery to implement the sliding...

How to set static IP in CentOS7 on VirtualBox6 and what to note

Install CentOS 7 after installing VirtualBox. I w...

Detailed explanation of Excel parsing and exporting based on Vue

Table of contents Preface Basic Introduction Code...

A brief discussion on tags in HTML

0. What is a tag? XML/HTML CodeCopy content to cl...

A brief introduction to web2.0 products and functions

<br />What is web2.0? Web2.0 includes those ...

How to use ECharts in WeChat Mini Programs using uniapp

Today, we use uniapp to integrate Echarts to disp...

Tomcat8 uses cronolog to split Catalina.Out logs

background If the catalina.out log file generated...

How to implement paging query in MySQL

SQL paging query:background In the company's ...

Share MySql8.0.19 installation pit record

The previous article introduced the installation ...

SVG+CSS3 to achieve a dynamic wave effect

A vector wave <svg viewBox="0 0 560 20&qu...

The difference between shtml and html

Shtml and asp are similar. In files named shtml, s...