Résolu le 16-11-18 mysql installation

Assistance concernant Linux Mint
Répondre
jcBastien
Messages : 6
Enregistré le : dim. 14 oct. 2018 20:03

mysql installation

Message par jcBastien »

Bonjour,

Je voudrais une précision concernant mysql.

Je suis sur linux mint 19 cinnamon 64 bits, j’ai installé via le gestionnaire de logiciels mysql-server et mysql-client.

j’ai ensuite fait la commande : sudo mysql_secure_installation pour définir un mot de passe root pour mysql.

Jusque-là tout va bien. Mais quand je regarde les nombreux tutos d’utilisation de mysql, ils indiquent de lancer mysql via la commande mysql -u root -p, or chez moi elle ne marche pas. Je dois faire la commande sudo mysql -u root -p.

voici le retour de mysql -u root -p
ERROR 1698 (28000) : Access denied for user ‘root'@'localhost’

En cherchant sur le net j’ai fait ceci :
sudo mysql -u root -p
USE mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
FLUSH PRIVILEGES;
exit;
service mysql restart

maintenant quand je lance mysql -u root -p j’ai ceci :
ERROR 1045 (28000) : Access denied for user ‘root'@'localhost’ (using password : YES)

Je sais que je débute sur Linux, mais j’ai oublié de faire quelque chose ?

Merci d'avance
Modifié en dernier par jcBastien le ven. 16 nov. 2018 17:04, modifié 1 fois.

Avatar du membre
arghlub
Administrateur du site
Messages : 10421
Enregistré le : dim. 21 mai 2017 08:19
Localisation : Provence
Contact :

Re: mysql installation

Message par arghlub »

Salut,

Étrange, chez moi pas de souci (avec MySql version 5.7.24)
Es-tu sûr d'avoir bien mis un mot de passe root ?
Refais un :

Code : Tout sélectionner

sudo mysql_secure_installation
Tour1 (custom)CM MSI Z270 M3 | CPU Intel I7-7700K | CG Nvidia GTX 1080 | RAM 16Go | tripleBoot : Debian 11 | MXlinux 21 | LMint 19.3 | XFCE
Tour2 (custom)CM Gigabyte | CPU AMD Athlon 5200+ | CG Nvidia GTX 560 | RAM 6Go | FreeBSD 12.1 XFCE
Portable1 MSI GF75 Thin 9SC | CPU Intel I7-9750H | CG Nvidia GTX 1650 | RAM 32Go | dualBoot : LMint 20.2 | MXlinux 21 | XFCE
Portable2 MacBook Air A1466 (2015) | CPU Intel I5-5250U | CG Intel HD Graphics 6000 | RAM 8Go | dualBoot : macOS Sierra | MXlinux 21 XFCE
─────( pour une informatique libre ! -membre en stand-by de l' April.org────────────────

jcBastien
Messages : 6
Enregistré le : dim. 14 oct. 2018 20:03

Re: mysql installation

Message par jcBastien »

Oui avec la commande sudo mysql_secure_installation. je suis aussi avec la version 5.7.24

Avatar du membre
arghlub
Administrateur du site
Messages : 10421
Enregistré le : dim. 21 mai 2017 08:19
Localisation : Provence
Contact :

Re: mysql installation

Message par arghlub »

Essaie alors de désinstaller mysql :

Code : Tout sélectionner

sudo apt purge mysql*
Et refais la procédure d'installation :

Code : Tout sélectionner

sudo apt install mysql-client mysql-server && sudo mysql_secure_installation
Tour1 (custom)CM MSI Z270 M3 | CPU Intel I7-7700K | CG Nvidia GTX 1080 | RAM 16Go | tripleBoot : Debian 11 | MXlinux 21 | LMint 19.3 | XFCE
Tour2 (custom)CM Gigabyte | CPU AMD Athlon 5200+ | CG Nvidia GTX 560 | RAM 6Go | FreeBSD 12.1 XFCE
Portable1 MSI GF75 Thin 9SC | CPU Intel I7-9750H | CG Nvidia GTX 1650 | RAM 32Go | dualBoot : LMint 20.2 | MXlinux 21 | XFCE
Portable2 MacBook Air A1466 (2015) | CPU Intel I5-5250U | CG Intel HD Graphics 6000 | RAM 8Go | dualBoot : macOS Sierra | MXlinux 21 XFCE
─────( pour une informatique libre ! -membre en stand-by de l' April.org────────────────

jcBastien
Messages : 6
Enregistré le : dim. 14 oct. 2018 20:03

Re: mysql installation

Message par jcBastien »

Merci pour ta réponse.
Je viens de le faire. avec sudo cela marche bien. sans le sudo j'ai :
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

Avatar du membre
arghlub
Administrateur du site
Messages : 10421
Enregistré le : dim. 21 mai 2017 08:19
Localisation : Provence
Contact :

Re: mysql installation

Message par arghlub »

Là je bugue un peu...
Normalement, les lignes que tu spécifies dans ton 1er message auraient du rétablir tout ça :

Code : Tout sélectionner

sudo mysql -u root -p
mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;
Désolé, là je vois pas ce qui cloche, je passe la main à un expert de MySql. ;)

[EDIT] Pour voir quelles sont les autorisations, lance cette commande dans MySql :

Code : Tout sélectionner

SELECT User, Host, plugin FROM mysql.user;
Tour1 (custom)CM MSI Z270 M3 | CPU Intel I7-7700K | CG Nvidia GTX 1080 | RAM 16Go | tripleBoot : Debian 11 | MXlinux 21 | LMint 19.3 | XFCE
Tour2 (custom)CM Gigabyte | CPU AMD Athlon 5200+ | CG Nvidia GTX 560 | RAM 6Go | FreeBSD 12.1 XFCE
Portable1 MSI GF75 Thin 9SC | CPU Intel I7-9750H | CG Nvidia GTX 1650 | RAM 32Go | dualBoot : LMint 20.2 | MXlinux 21 | XFCE
Portable2 MacBook Air A1466 (2015) | CPU Intel I5-5250U | CG Intel HD Graphics 6000 | RAM 8Go | dualBoot : macOS Sierra | MXlinux 21 XFCE
─────( pour une informatique libre ! -membre en stand-by de l' April.org────────────────

jcBastien
Messages : 6
Enregistré le : dim. 14 oct. 2018 20:03

Re: mysql installation

Message par jcBastien »

ya pas de mal.. merci quand mème.

J'ai ceci :

Code : Tout sélectionner

mysql> SELECT User, Host, plugin FROM mysql.user;
+------------------+-----------+-----------------------+
| User             | Host      | plugin                |
+------------------+-----------+-----------------------+
| root             | localhost | auth_socket           |
| mysql.session    | localhost | mysql_native_password |
| mysql.sys        | localhost | mysql_native_password |
| debian-sys-maint | localhost | mysql_native_password |
+------------------+-----------+-----------------------+
4 rows in set (0.00 sec)
Modifié en dernier par arghlub le ven. 16 nov. 2018 16:26, modifié 1 fois.
Raison : ajout de balises [code] pour une meilleure lisibilité

Avatar du membre
arghlub
Administrateur du site
Messages : 10421
Enregistré le : dim. 21 mai 2017 08:19
Localisation : Provence
Contact :

Re: mysql installation

Message par arghlub »

On voit clairement que ta première ligne ne va pas :

Code : Tout sélectionner

| root             | localhost | auth_socket           |
devrait ressembler à ça :

Code : Tout sélectionner

| root             | localhost | mysql_native_password |

Donc pour corriger, refais ces lignes dans mySQL :

Code : Tout sélectionner

USE mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
FLUSH PRIVILEGES;
exit;
Tour1 (custom)CM MSI Z270 M3 | CPU Intel I7-7700K | CG Nvidia GTX 1080 | RAM 16Go | tripleBoot : Debian 11 | MXlinux 21 | LMint 19.3 | XFCE
Tour2 (custom)CM Gigabyte | CPU AMD Athlon 5200+ | CG Nvidia GTX 560 | RAM 6Go | FreeBSD 12.1 XFCE
Portable1 MSI GF75 Thin 9SC | CPU Intel I7-9750H | CG Nvidia GTX 1650 | RAM 32Go | dualBoot : LMint 20.2 | MXlinux 21 | XFCE
Portable2 MacBook Air A1466 (2015) | CPU Intel I5-5250U | CG Intel HD Graphics 6000 | RAM 8Go | dualBoot : macOS Sierra | MXlinux 21 XFCE
─────( pour une informatique libre ! -membre en stand-by de l' April.org────────────────

jcBastien
Messages : 6
Enregistré le : dim. 14 oct. 2018 20:03

Re: mysql installation

Message par jcBastien »

merci pour ta réponse. en mème temps que tu as fait ton post, j'ai créer un user avec

Code : Tout sélectionner

CREATE USER 'bastien'@'localhost' IDENTIFIED BY '-------';
GRANT ALL PRIVILEGES ON *.* TO 'bastien'@'localhost' WITH GRANT OPTION;
et ca marche. la preuve :

Code : Tout sélectionner

bastien@bastien-XPS-8900:~$ mysql -u bastien -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.7.24-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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

mysql> SELECT User, Host, plugin FROM mysql.user;
+------------------+-----------+-----------------------+
| User             | Host      | plugin                |
+------------------+-----------+-----------------------+
| root             | localhost | auth_socket           |
| mysql.session    | localhost | mysql_native_password |
| mysql.sys        | localhost | mysql_native_password |
| debian-sys-maint | localhost | mysql_native_password |
| bastien          | localhost | mysql_native_password |
+------------------+-----------+-----------------------+
5 rows in set (0.00 sec)
merci pour tout

Avatar du membre
arghlub
Administrateur du site
Messages : 10421
Enregistré le : dim. 21 mai 2017 08:19
Localisation : Provence
Contact :

Re: mysql installation

Message par arghlub »

Super 8-)

Tu peux donc passer ton sujet en "résolu".
Pour cela édite un message du sujet et modifie son attribut :
Image
;)
Tour1 (custom)CM MSI Z270 M3 | CPU Intel I7-7700K | CG Nvidia GTX 1080 | RAM 16Go | tripleBoot : Debian 11 | MXlinux 21 | LMint 19.3 | XFCE
Tour2 (custom)CM Gigabyte | CPU AMD Athlon 5200+ | CG Nvidia GTX 560 | RAM 6Go | FreeBSD 12.1 XFCE
Portable1 MSI GF75 Thin 9SC | CPU Intel I7-9750H | CG Nvidia GTX 1650 | RAM 32Go | dualBoot : LMint 20.2 | MXlinux 21 | XFCE
Portable2 MacBook Air A1466 (2015) | CPU Intel I5-5250U | CG Intel HD Graphics 6000 | RAM 8Go | dualBoot : macOS Sierra | MXlinux 21 XFCE
─────( pour une informatique libre ! -membre en stand-by de l' April.org────────────────

Répondre