Back up and restore a MySQL database
Create a reliable backup with mysqldump, restore it, and set up a routine so you never lose data.
Learn
Practical lessons drawn from years of teaching and real projects.
Create a reliable backup with mysqldump, restore it, and set up a routine so you never lose data.
Checks that really matter: size, real file type, a new random name, and a folder that cannot run code.
List, add, edit and delete records safely: prepared statements, escaped output and a POST for every change.
Store in UTC, show in the visitor's time zone, and avoid the usual bugs.
Download a table as CSV and read an uploaded CSV safely.
Send a one-time link that expires, and store only a hash of the token.
Return data from MySQL as JSON, with correct headers and status codes.
Validate, block header injection and save a copy in the database.
Check every value on the server, show clear messages and keep what the user typed.
Group data and behaviour together, and use a class to wrap database work.
Search a table by keyword without SQL injection.
Show 10 records per page with Previous and Next links.
Turn many rows into summaries: totals, averages and counts per group.
Combine rows from two tables with INNER JOIN and LEFT JOIN.
Register, hash passwords, log in and protect pages, the safe way.