This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux:general:mysql [2019/06/06 14:11] – created 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 ==== | ||
+ | |||
+ | === Backup === | ||
+ | |||
+ | Backup a single table in a database | ||
+ | < | ||
+ | mysqldump <db> < | ||
+ | </ | ||
+ | |||
+ | Backup all tables in a single database | ||
+ | < | ||
+ | mysqldump <db> > dump.sql | ||
+ | </ | ||
+ | |||
+ | Backup all tables in all databases | ||
+ | < | ||
+ | mysqldump --all-databases > dump.sql | ||
+ | </ | ||
+ | |||
+ | Also check out a script to backup all databases from my collegue Tom [[https:// | ||
+ | |||
+ | === Restore === | ||
+ | < | ||
+ | mysql < dump.sql | ||
+ | </ | ||
+ | |||
+ | Also check out a script to restore databases from my collegue Tom [[https:// | ||
==== Commands ==== | ==== Commands ==== | ||
^ Command | ^ Command | ||
- | | %%iptables | + | | %%mysqldump%% |
- | | %%iptables | + | | %%mysqlcheck --repair --databases <db>%% | |
- | | %%iptables | + | | %%mysqlcheck |
+ | | %%mysql -uroot -p -h 127.0.0.1 -P 3306%% | | ||
==== Troubleshooting ==== | ==== Troubleshooting ==== | ||
+ | |||
+ | |||
+ | ==== Links ==== | ||
+ | |||
+ | https:// | ||
+ | |||
+ |