notes/article/mysql/backup.md

33 lines
477 B
Markdown

# Mysql Config
## Backup and recover
### Backup
Backup all databases schema with data:
```bash
mysqldump -uroot -p123456 -h localhost -P 3306 --all-databases --default-character-set=utf8 --single-transaction > all.sql
```
Bakcup specified database
### Restore Databases
```bash
mysql -uroot -p123456 < all.sql
```
## User Config
### Creation
```bash
create user 'work'@'%' identified by '123456';
```
### Grant privileges
```bash
grant all on *.* to 'work'@'%';
```