MySQL and MariaDB on the command line.
HOW TO CONNECT
The client command, with a user, a password prompt, and optionally a database.
WHY TO USE THE PROMPT RATHER THAN A PASSWORD ON THE COMMAND LINE
Command lines are visible to other users and stored in history.
WHAT TO USE INSTEAD FOR SCRIPTS
A credentials file readable only by the owner.
WHAT THE ESSENTIAL COMMANDS ARE
Show databases Use a database Show tables Describe a table Show the process list
WHAT TO END EVERY STATEMENT WITH
A semicolon.
WHY IT CONFUSES BEGINNERS
Without it the client waits, appearing frozen.
HOW TO EXPORT A DATABASE
The dump tool, redirecting output to a file.
WHAT OPTIONS MATTER
Including routines and triggers Single transaction, for consistency without locking Compression, applied afterwards
HOW TO IMPORT
Redirect the file into the client, with the target database named.
WHAT TO CREATE FIRST
The database, which the dump usually does not.
WHAT TO WATCH FOR ON IMPORT
Character set mismatches, which corrupt text Definer clauses referencing users that do not exist
WHAT TO CHECK AFTERWARDS
Row counts against the source.
WHAT TO NEVER DO
Copy the data directory of a running database.