Copy Database To Another DB On Ubuntu
We can copy the database from host to host using SQLYog. Suppose we want to have the database from one DB server to another DB server using SQLYog. I have installed MySQL 5.7 as shown in the figure below.
SQLYog is basically used to access, perform SQL queries based on GUI and easy to use. we can perform the same task as we do use CLI mode in the server. you can use and manage your databases including all the tasks like copy, backup, import and restore the databases.
Once you have installed and MySQL server. you have to start the service and grant the access permission to a user. So, you can use those credentials to log in to the SQLyog with GUI mode.
root@ubuntu:~# /etc/init.d/mysql start [ ok ] Starting mysql (via systemctl): mysql.service.
Check the MySQL version using mysql
root@ubuntu:~# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.29-0ubuntu0.18.04.1 (Ubuntu)
Check Out: How To Make EBS Volume To Use On AWS Cloud
I will create a table and database using the following commands.
mysql> create database testing; Query OK, 1 row affected (0.01 sec) mysql> create database backup; Query OK, 1 row affected (0.00 sec)
Now create a table in the testing database.
mysql> use testing; Database changed mysql> CREATE TABLE tb (name VARCHAR(20), owner VARCHAR(20), -> species VARCHAR(20), sex CHAR(1), born DATE, birth DATE); Query OK, 0 rows affected (0.06 sec) mysql> show tables; +-------------------+ | Tables_in_testing | +-------------------+ | tb | +-------------------+ 1 row in set (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
I will start copying the database table to another DB called backup using SQLYog tool.
Right-click on the testing database and select copy database to different host/database.
You can select the database in the target Connection section and database where you have to copy. Now click on copy. Testing Database copied successfully to the backup database.
Now check the data in the backup database.
In a similar way, you can copy the database using SQLYog from host to host.
You’re done copy host database sqlyog