MaJ du 04-02-2021

This commit is contained in:
2021-02-04 09:55:26 +01:00
parent 84b4e1a85d
commit fb07a20b0c
56 changed files with 4962 additions and 95 deletions

53
docs/MySQL/password.md Normal file
View File

@@ -0,0 +1,53 @@
# MySQL Password
### Rentrer automatiquement le mot de passe MySQL:
Stocker le mot de passe dans le `~/.my.cnf`.
```mysql
[client]
user=mysqlbackupuser
password=xxxxxxxx
```
```bash
$ mysql -e "SHOW DATABASES"
+--------------------+
| Database |
+--------------------+
| information_schema |
| mistral |
| mysql |
| npg |
| performance_schema |
| wordpress |
| zenphoto |
+--------------------+
```
### Avoir 1 mot de passe par base ou par host:
Dans le `~/.my.cnf`.
```mysql
[clienthost1] # Note: client + host1
user=myuser
password=mypass
database=dbname
host=server.location.com
```
```bash
$ mysql --defaults-group-suffix=host1
```
Bonus: créer un alias dans `.profile` (.zshrc...):
```bash
echo 'alias mysql_host1="mysql --defaults-group-suffix=host1"' >> ~/.profile
```