# Connexion à la base:



### Se connecter à MySQL:

```bash
$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.3.11-MariaDB Homebrew

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>
```



### Se connecter directement à une base:

```bash
$ mysql -u root -p wordpress
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 139
Server version: 10.6.4-MariaDB Homebrew

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [wordpress]>
```



`$ mysql -u root -pwordpress`: se connecter directement à MySQL avec le mot de passe 'wordpress'.

`$ mysql -u root -p wordpress`: se connecter à la base wordpress. Le mot de passe est demandé.

`$ mysql -u root -ppassword wordpress`: se connecter directement à la base wordpress avec le mot de passe 'password'.



### Configuration:

#### my.cnf

```bash
bruno@SilverBook: /usr/local/etc $ ls -la
total 160
-rw-r--r--    1 bruno  admin    212  4 sep 16:53 my.cnf
drwxr-xr-x    3 bruno  admin     96 16 aoû 10:43 my.cnf.d
-rw-r--r--    1 bruno  admin    113  4 sep 16:53 my.cnf.default
```

```bash
bruno@SilverBook: /usr/local/etc/my.cnf.d $ l
total 0
-rw-r--r--   1 bruno  admin     0 16 aoû 10:43 wont_prune.txt
```



### Quitter MySQL:

```bash
MariaDB [wordpress4]> exit
Bye
```

