dev:kb:database:mysql
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| dev:kb:database:mysql [2014/02/01 11:52] – [Create backup account] hackerzhou | dev:kb:database:mysql [2020/06/06 23:32] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== MySQL ====== | ====== MySQL ====== | ||
| + | ==== Update MySQL root password ==== | ||
| + | <code bash> | ||
| + | sudo mysqladmin -u root -p password '< | ||
| + | </ | ||
| + | |||
| + | ==== Allow MySQL root remote access ==== | ||
| + | <code sql> | ||
| + | update mysql.user set host = ' | ||
| + | </ | ||
| ==== Create backup account ==== | ==== Create backup account ==== | ||
| <code sql> | <code sql> | ||
| Line 7: | Line 16: | ||
| ==== MySQL backup & restore SQL file ==== | ==== MySQL backup & restore SQL file ==== | ||
| <code bash> | <code bash> | ||
| - | mysqldump -ubackupuser -pbackuppassword --all-databases > all.sql | + | mysqldump -ubackupuser -pbackuppassword --all-databases |
| mysql -ubackupuser -pbackuppassword < all.sql; | mysql -ubackupuser -pbackuppassword < all.sql; | ||
| </ | </ | ||
| Line 15: | Line 24: | ||
| create user < | create user < | ||
| grant all privileges on < | grant all privileges on < | ||
| + | </ | ||
| + | |||
| + | ==== Show all accounts ==== | ||
| + | <code sql> | ||
| + | select user, | ||
| + | </ | ||
| + | |||
| + | ==== Create database using UTF-8 charset ==== | ||
| + | <code sql> | ||
| + | CREATE database IF NOT EXISTS < | ||
| </ | </ | ||
dev/kb/database/mysql.1391255542.txt.gz · Last modified: (external edit)
