This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:general:mysql [2019/06/06 14:19] – lunetikk | linux:general:mysql [2020/01/13 22:31] (current) – lunetikk | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | FIXME | ||
| - | |||
| ===== MySQL ===== | ===== MySQL ===== | ||
| ==== Install ==== | ==== Install ==== | ||
| + | |||
| + | < | ||
| + | apt-get install mysql-server | ||
| + | </ | ||
| ==== Configure ==== | ==== Configure ==== | ||
| + | |||
| + | Execute the following after the installation | ||
| + | < | ||
| + | |||
| + | You can find the config in | ||
| + | < | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | ==== Passwordless login ==== | ||
| + | |||
| + | If you want to automate things you might want to login without a plaintext password. | ||
| + | |||
| + | === Add profile === | ||
| + | |||
| + | :!: WARNING: YOU SHOULD NOT ADD ROOT AS A PROFILE, THE PASSWORD STORE IS NOT SECURE :!: | ||
| + | |||
| + | Add a profile to your MySQL config | ||
| + | < | ||
| + | |||
| + | You can now login via | ||
| + | < | ||
| + | |||
| + | === Show profiles === | ||
| + | |||
| + | All profiles can be listed via | ||
| + | < | ||
| + | |||
| + | You cant edit the file " | ||
| + | < | ||
| ==== Backup and Restore ==== | ==== Backup and Restore ==== | ||
| Line 11: | Line 43: | ||
| === Backup === | === Backup === | ||
| - | Backup a single | + | Backup a single |
| < | < | ||
| mysqldump <db> < | mysqldump <db> < | ||
| Line 25: | Line 57: | ||
| mysqldump --all-databases > dump.sql | mysqldump --all-databases > dump.sql | ||
| </ | </ | ||
| + | |||
| + | Also check out a script to backup all databases from my collegue Tom [[https:// | ||
| === Restore === | === Restore === | ||
| Line 30: | Line 64: | ||
| mysql < dump.sql | mysql < dump.sql | ||
| </ | </ | ||
| + | |||
| + | Also check out a script to restore databases from my collegue Tom [[https:// | ||
| ==== Commands ==== | ==== Commands ==== | ||
| Line 37: | Line 73: | ||
| | %%mysqlcheck --repair --databases < | | %%mysqlcheck --repair --databases < | ||
| | %%mysqlcheck --repair --all-databases%% | | %%mysqlcheck --repair --all-databases%% | ||
| + | | %%mysql -uroot -p -h 127.0.0.1 -P 3306%% | ||
| ==== Troubleshooting ==== | ==== Troubleshooting ==== | ||