SlideShare a Scribd company logo
1/7
How to Export/Import a MySQL database via SSH in
AWS Lightsail WordPress
rizwanrafiq.com/export-import-a-mysql-database-via-ssh-in-aws-lightsail-wordpress
Suppose you want a database backup of any instances ‘ in AWS Lightsail WordPress ‘
through putty or SSH. For that, first, we need to create an instance. In this article, I am
assuming that you already have a WordPress instance in Lightsail.
1:Download Instance SSH Key
So you need to download the SSH key of this instance. This is an essential step. Follow the
below screenshot to download the SSH key in Lightsail.
2:Install PUTTYgen
Download PUTTYgen through below mentioned link (For SSH), and install this file into
your system.
https://www.puttygen.com/
Now Open PUTTYgen and click on ‘load’ and select the downloaded SSH key file and after
that click on the ‘save private key’ file. Save this file with any name with this (*.ppk)
extension.
2/7
3:Install PUTTY
Download PUTTY through below mentioned link, and after that, install this file into your
system.
https://www.puttygen.com/
Now, Open PUTTY, in ‘Host Name’ input filed you need to write your Lightsail instance’s
Static IP address, now give the name to a session and then save and after that click on
‘Data’ under ‘Connection’ (left bar), write username of your instance in the field ‘Auto-
login username’ (bitnami, ubuntu, etc according to the type of instance ), again go to left
bar and click on ‘SSH'(click on SSH ‘+’ sign) then click on ‘Auth’, now choose Private
Key(*.ppk) file.
OR, If you want to open your AWS Lightsail Instance ‘ PHPMyAdmin ‘ database, and also
you want to check if your Instnace database is available in ‘PHPMyAdmin’ or not, then
follow these steps;
Go to the left bar and click on ‘SSH'(click on SSH ‘+’ sign) then click on ‘Tunnels’, now
add ‘8888’ in the Source post field and add ‘localhost:80’ in the Destination field. Now
click on ‘Session’ on the left bar and now choose your last session (in my case, the last
session was ‘aws session’ ) then click on ‘save’ and now click on ‘open’ then it will show
you a popup and you need to click on “Yes”.
3/7
4: Filezilla or WinSCP
Download Filezilla or WinSCP through this link, and after that, install this file into your
system.
https://filezilla-project.org/download.php
OR
https://winscp.net/eng/download.php
Open Filezilla/WinSCP to connect to your Instance. I’ll choose Filezilla for this work.
Go to the Edit option of Filezilla > open settings > click SFTP > pick the Private key of
your Lightsail Instance (*.ppk).
4/7
5:Filezilla Connection
After that go back to the main page of Filezilla and Write-host (IP/domain), the
username (server name), password (instance password), Port (22), and Quick
connect this.
After that, you will see your Lightsail instance directories are showing. Now, create a new
directory/folder for AWS Lightsail database backup and also copy the entire path with the
new folder.
6:Check Instance Databases through PUTTY
Now back to the PUTTY, write some commands For checking, is this showing all
databases & tables of Lightsail instance,
sudo su
mysql -u root -p -h localhost (root mean USERNAME OF DB, P mean password)
show databases; (show all databases)
use DATABASE NAME; (Backup Database name)
show tables; (show all tables of your backup DB)
exit
7:Command for export Lightsail Instance database
mysqldump -u DATABASE USERNAME -p –h localhost DBNAME –single-
transaction –quick –lock-tables=false > Paste Filezilla path where you save
backup/filename.sql
Note: Must care for the Angle Bracket inside the Command. Don’t change this Angle
Bracket. Otherwise, you can’t take a backup of your AWS Lightsail database tables.
5/7
Commands:
mysqldump -u root -p -h localhost wp_demo –single-transaction –quick –lock-
tables=false > /opt/bitnami/apache2/htdocs/bbbb/backup.sql
enter password
After some time, you will see your database tables will have been created with your given
Filezilla path.
Now, you can delete all tables of your backup database from MySQL and after that, you
can also check your database backup whether it is imported in MySQL or not.
8:Check Database
Again back to the PUTTY, and write below mentioned commands
6/7
sudo su
mysql –u USERNAME –P
Enter Password
show databases;
use DBNAME; (backup database name )
show tables; (now you will see all tables are missing)
exit
9:Command for import Lightsail Instance database
mysql -u USERNAME DB -p –h localhost DBNAME –single-transaction –quick –
lock-tables=false < Address link where you save backup/filename.sql
Note: Must care for the Angle Bracket inside the Command. Don’t change this Angle
Bracket. Otherwise, you can’t import backups of your AWS Lightsail database tables.
Commands:
mysql -u root -p -h localhost wp_demo <
/opt/bitnami/apache2/htdocs/bbbb/backup.sql
Enter password
After some seconds all tables will be successfully imported.
10:Import Database Tables
Now if you want to check if tables have been imported or not, then you can repeat all
previous commands;
sudo su
mysql –u USERNAME –P
Enter Password
show databases;
7/7
use DBNAME; (backup database name)
show tables; (now you will see all tables are again showing)
exit
Related Article: How can we Upload Large Files to AWS S3?

More Related Content

PDF
CloudFront와 S3를 이용한 컨텐츠 배포 전략 - 박현우 CTO, SMARTSTUDY
PPTX
Devoxx 2012 hibernate envers
PDF
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - DevO...
PDF
Git slides
PDF
Formation Spring Avancé gratuite par Ippon 2014
PPTX
從實戰經驗看到的 K8S 導入痛點
PDF
Scouter와 influx db – grafana 연동 가이드
PPTX
Implementing a Database and API for your Cloud Service
CloudFront와 S3를 이용한 컨텐츠 배포 전략 - 박현우 CTO, SMARTSTUDY
Devoxx 2012 hibernate envers
Running Kubernetes in Production: A Million Ways to Crash Your Cluster - DevO...
Git slides
Formation Spring Avancé gratuite par Ippon 2014
從實戰經驗看到的 K8S 導入痛點
Scouter와 influx db – grafana 연동 가이드
Implementing a Database and API for your Cloud Service

What's hot (20)

PDF
Spring Framework - Spring Security
PPTX
Best practices for ansible
PDF
Course 102: Lecture 10: Learning About the Shell
PDF
날로 먹는 Django admin 활용
PDF
Spring Boot & Containers - Do's & Don'ts
PDF
MySQL Group Replication - HandsOn Tutorial
PPTX
Activiti bpm
PDF
Introduction to Spring Boot
PPTX
20345-1B_02.pptx
PDF
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
PDF
Version Control & Git
PPTX
Php cookies
PDF
Free bsd jail入門
PDF
e2e testing with cypress
PDF
spring-api-rest.pdf
PDF
Trace File Analyzer - Usage and Features
PDF
ProxySQL on Kubernetes
PDF
Investigation report on 64 bit support in Android Open Source Project
PDF
Service Mesh @Lara Camp Myanmar - 02 Sep,2023
Spring Framework - Spring Security
Best practices for ansible
Course 102: Lecture 10: Learning About the Shell
날로 먹는 Django admin 활용
Spring Boot & Containers - Do's & Don'ts
MySQL Group Replication - HandsOn Tutorial
Activiti bpm
Introduction to Spring Boot
20345-1B_02.pptx
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Version Control & Git
Php cookies
Free bsd jail入門
e2e testing with cypress
spring-api-rest.pdf
Trace File Analyzer - Usage and Features
ProxySQL on Kubernetes
Investigation report on 64 bit support in Android Open Source Project
Service Mesh @Lara Camp Myanmar - 02 Sep,2023
Ad

More from AlexRobert25 (10)

PDF
10 Ways to Improve Writing Skills in 2023 – Beginner to Professional Guide
PDF
readessay.com-Types of Accounting and Careers and Job Opportunities in 2022-2...
PDF
Top Assignment Cover Page Ideas
PDF
Managerial accounting - read essay
PDF
Maus an analysis novel by art spiegelman
PDF
Applications of Physics
PDF
Kuwait Trade Union Federation
PDF
How Toyota Turns Workers into Problem Solvers
PDF
Dc motor modelling lab report
PDF
Impact of computers on big data
10 Ways to Improve Writing Skills in 2023 – Beginner to Professional Guide
readessay.com-Types of Accounting and Careers and Job Opportunities in 2022-2...
Top Assignment Cover Page Ideas
Managerial accounting - read essay
Maus an analysis novel by art spiegelman
Applications of Physics
Kuwait Trade Union Federation
How Toyota Turns Workers into Problem Solvers
Dc motor modelling lab report
Impact of computers on big data
Ad

Recently uploaded (20)

PDF
Sensors and Actuators in IoT Systems using pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
KodekX | Application Modernization Development
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
MYSQL Presentation for SQL database connectivity
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
Sensors and Actuators in IoT Systems using pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
madgavkar20181017ppt McKinsey Presentation.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Spectral efficient network and resource selection model in 5G networks
Chapter 3 Spatial Domain Image Processing.pdf
KodekX | Application Modernization Development
Diabetes mellitus diagnosis method based random forest with bat algorithm
MYSQL Presentation for SQL database connectivity
CIFDAQ's Market Insight: SEC Turns Pro Crypto
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Per capita expenditure prediction using model stacking based on satellite ima...
20250228 LYD VKU AI Blended-Learning.pptx

How to export import a mysql database via ssh in aws lightsail wordpress rizwanrafiq.com

  • 1. 1/7 How to Export/Import a MySQL database via SSH in AWS Lightsail WordPress rizwanrafiq.com/export-import-a-mysql-database-via-ssh-in-aws-lightsail-wordpress Suppose you want a database backup of any instances ‘ in AWS Lightsail WordPress ‘ through putty or SSH. For that, first, we need to create an instance. In this article, I am assuming that you already have a WordPress instance in Lightsail. 1:Download Instance SSH Key So you need to download the SSH key of this instance. This is an essential step. Follow the below screenshot to download the SSH key in Lightsail. 2:Install PUTTYgen Download PUTTYgen through below mentioned link (For SSH), and install this file into your system. https://www.puttygen.com/ Now Open PUTTYgen and click on ‘load’ and select the downloaded SSH key file and after that click on the ‘save private key’ file. Save this file with any name with this (*.ppk) extension.
  • 2. 2/7 3:Install PUTTY Download PUTTY through below mentioned link, and after that, install this file into your system. https://www.puttygen.com/ Now, Open PUTTY, in ‘Host Name’ input filed you need to write your Lightsail instance’s Static IP address, now give the name to a session and then save and after that click on ‘Data’ under ‘Connection’ (left bar), write username of your instance in the field ‘Auto- login username’ (bitnami, ubuntu, etc according to the type of instance ), again go to left bar and click on ‘SSH'(click on SSH ‘+’ sign) then click on ‘Auth’, now choose Private Key(*.ppk) file. OR, If you want to open your AWS Lightsail Instance ‘ PHPMyAdmin ‘ database, and also you want to check if your Instnace database is available in ‘PHPMyAdmin’ or not, then follow these steps; Go to the left bar and click on ‘SSH'(click on SSH ‘+’ sign) then click on ‘Tunnels’, now add ‘8888’ in the Source post field and add ‘localhost:80’ in the Destination field. Now click on ‘Session’ on the left bar and now choose your last session (in my case, the last session was ‘aws session’ ) then click on ‘save’ and now click on ‘open’ then it will show you a popup and you need to click on “Yes”.
  • 3. 3/7 4: Filezilla or WinSCP Download Filezilla or WinSCP through this link, and after that, install this file into your system. https://filezilla-project.org/download.php OR https://winscp.net/eng/download.php Open Filezilla/WinSCP to connect to your Instance. I’ll choose Filezilla for this work. Go to the Edit option of Filezilla > open settings > click SFTP > pick the Private key of your Lightsail Instance (*.ppk).
  • 4. 4/7 5:Filezilla Connection After that go back to the main page of Filezilla and Write-host (IP/domain), the username (server name), password (instance password), Port (22), and Quick connect this. After that, you will see your Lightsail instance directories are showing. Now, create a new directory/folder for AWS Lightsail database backup and also copy the entire path with the new folder. 6:Check Instance Databases through PUTTY Now back to the PUTTY, write some commands For checking, is this showing all databases & tables of Lightsail instance, sudo su mysql -u root -p -h localhost (root mean USERNAME OF DB, P mean password) show databases; (show all databases) use DATABASE NAME; (Backup Database name) show tables; (show all tables of your backup DB) exit 7:Command for export Lightsail Instance database mysqldump -u DATABASE USERNAME -p –h localhost DBNAME –single- transaction –quick –lock-tables=false > Paste Filezilla path where you save backup/filename.sql Note: Must care for the Angle Bracket inside the Command. Don’t change this Angle Bracket. Otherwise, you can’t take a backup of your AWS Lightsail database tables.
  • 5. 5/7 Commands: mysqldump -u root -p -h localhost wp_demo –single-transaction –quick –lock- tables=false > /opt/bitnami/apache2/htdocs/bbbb/backup.sql enter password After some time, you will see your database tables will have been created with your given Filezilla path. Now, you can delete all tables of your backup database from MySQL and after that, you can also check your database backup whether it is imported in MySQL or not. 8:Check Database Again back to the PUTTY, and write below mentioned commands
  • 6. 6/7 sudo su mysql –u USERNAME –P Enter Password show databases; use DBNAME; (backup database name ) show tables; (now you will see all tables are missing) exit 9:Command for import Lightsail Instance database mysql -u USERNAME DB -p –h localhost DBNAME –single-transaction –quick – lock-tables=false < Address link where you save backup/filename.sql Note: Must care for the Angle Bracket inside the Command. Don’t change this Angle Bracket. Otherwise, you can’t import backups of your AWS Lightsail database tables. Commands: mysql -u root -p -h localhost wp_demo < /opt/bitnami/apache2/htdocs/bbbb/backup.sql Enter password After some seconds all tables will be successfully imported. 10:Import Database Tables Now if you want to check if tables have been imported or not, then you can repeat all previous commands; sudo su mysql –u USERNAME –P Enter Password show databases;
  • 7. 7/7 use DBNAME; (backup database name) show tables; (now you will see all tables are again showing) exit Related Article: How can we Upload Large Files to AWS S3?