Anonymous

Changes

From NixNet
378 bytes added ,  02:05, 9 July 2021
m
add database dumps/restores
== Working with databases ==
* List all databases: <code>SHOW DATABASES;</code>* Select a database to interact with: <code>USE database;</code>* List tables: <code>SHOW TABLES;</code>* Show contents of a table: <code>SELECT * FROM table;</code>* Delete a row: <code>DELETE FROM table WHERE column=value;</code>*Dumping databases for backups: <code>mysqldump dbname > dbname_$(date -u -Iseconds).sql</code> (run as shell command)**Dumps with compression: <code>mysqldump dbname | gzip -c - > /root/dumps/dbname_$(date -u -Iseconds).sql.gz</code>*Restore database from backup: <code>mysql dbname < backup.sql</code>**With compression: <code>gunzip backup.sql.gz</code> then run command above
= Postgres =