Backing up and Restoring MySQL with mysqldump
I backup and restore databases across servers every few months, but each time I have to resort to reading this very verbose documentation. The steps below are a no fuss way to do this each time.
Backup Server
SSH into the server with the database that you wish to backup run the following command.mysqldump -u root -p $DB_NAME > $DB_NAME.sql
Copy the File to Destination Server
Using scp, we can securely transfer the backupscp $DB_NAME.sql $USER@$SERVER:
Restore on Destination Server
SSH into the server with the database that you wish to restore. From the the previous step the backup file should now be located in the root directory.- Create new database
mysql -u root -p -e 'CREATE DATABASE $DB_NAME'
- Restore your backup
mysql -u root -p $DB_NAME < $DB_NAME.sql
Thank you for reading! Share your thoughts with me on bluesky, mastodon, or via email.
Check out some more stuff to read down below.
Most popular posts this month
- SQLite DB Migrations with PRAGMA user_version
- Edge Detection with Inkscape
- Lev Lazinskiy
- Spring Security, Webjars, and MIME type error
- Using cgit
Recent Favorite Blog Posts
This is a collection of the last 8 posts that I bookmarked.
- Joining Cursor from Fatih Arslan
- Pluralistic: Digital sewer socialism (08 Aug 2026) from Pluralistic: Daily links from Cory Doctorow
- Pluralistic: Enshittification and Reverse Centaurs go global (29 Jul 2026) from Pluralistic: Daily links from Cory Doctorow
- AI Mania Is Eviscerating Global Decision-Making from Ludicity
- No-One Escapes the Permanent Underclass from Fernando Borretti
- Is it ethical to use AI? from charity.wtf
- The logical destination of LLMs from Andy Bell
- Revised rules of engineering leadership. from Irrational Exuberance
Articles from blogs I follow around the net
Oh Hey, It’s Not Just Me
My whole life I’ve felt like I have great eyesight (and I still do). But lately I’ve been noticing what feels like…some slippage. Nothing big. Just this feeling in the morning like, as my brain and body wake up, my vision needs to as well. The strange nove...
via Jim Nielsen’s Blog August 14, 2026“What actually happened was the birth of a genre in digital graphics”
A really well-produced 27-minute video from Super Splash Wave about 8-bit and 16-bit pixel art: What I liked about the video is that it doesn’t just revel in nostalgia, but goes deeper into some techniques and trends and details in the videogame graphics o...
via Unsung August 14, 2026curl performance
tldr: the live version is here: https://curl.se/perf/ How fast is “fast” and is it good enough? Does it run as fast now as it did before or was there a regression? What exactly needs to be fast? How fast is it? These are questions that many projects and pr...
via daniel.haxx.se August 14, 2026Generated by openring