Page 1 sur 1
[MariaDB] création mot de passe root impossible (résolu)
Publié : mar. 25 févr. 2020, 04:51
par ignace72
Bonjour à tous
Après une réinstallation, j'ai restauré ma base de données MariaDB.
Maintenant, impossible de créer un mot de passe root que j’essaie comme ça :
Avec
il me demande quand même un mot de passe.
avec
Code : Tout sélectionner
$ sudo systemctl stop mariadb
$ sudo mysqld_safe --skip-grant-tables &
puis
J'ai l'erreur suivante :
Code : Tout sélectionner
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld/mysqld.sock' (2)
Si quelqu'un a une idée pour résoudre mon problème ?
Merci
Re: [MariaDB] création mot de passe root impossible
Publié : mar. 25 févr. 2020, 12:10
par benjarobin
Si tu arrêtes MySQL, tu ne pourras pas t'y connecter.
Re: [MariaDB] création mot de passe root impossible
Publié : mar. 25 févr. 2020, 12:56
par ignace72
Merci de ta réponse rapide.
Avec MariaDB en marche :
Code : Tout sélectionner
$ sudo mysqld_safe --skip-grant-tables &
[1] 31639
11:31 [ignace@ignace-pc]~ $ mysql_secure_installation
[sudo] Mot de passe de ignace :
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
ERROR 1290 (HY000) at line 1: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
Enter current password for root (enter for none):
avec
Code : Tout sélectionner
mysql -u root
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 10.4.12-MariaDB Arch Linux
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)]> GRANT ALL PRIVILEGES ON *.* TO root@'localhost' IDENTIFIED BY 'mon_mot_de_passe';
ERROR 1290 (HY000): The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
Voilà
Re: [MariaDB] création mot de passe root impossible
Publié : mar. 25 févr. 2020, 17:43
par benjarobin
Pourquoi tu lances Mysql avec l'option --skip-grant-tables ?! Lances le service normalement.
Re: [MariaDB] création mot de passe root impossible
Publié : mar. 25 févr. 2020, 19:48
par ignace72
D'après ce que j'ai compris c'est pour se connecter en root sans mot de passe.
Bon sudo mysql_secure_installation marche maintenant
Problème résolu.