pb commande GRANT mysql

Soumis par Patsy le mer 28/04/2021 - 10:32

Bonjour,
J'ai l'impression de tourner en rond pour installer Laurux ... et je crois que plus je lis et tente les différentes commandes mysql ... moins je sais ce que je dois faire.
Sur Linux Mint 20.0,
Gambas installé avec les paquets Synaptic pour être certaine d'être sur la version 3.14.3
Mysql 8.0 : j'ai fait (j'ai mis mes commentaires entre des * * * * * pour une lecture plus "aisée") :

sylvie@sylvie-B85M-D3H:~$ sudo apt-get install mysql-server-8.0 mysql-client-8.0
[sudo] Mot de passe de sylvie :
Lecture des listes de paquets... ... ... installation des paquets ? ---> O(ui) ... dépaquetage / sélection / paramétrage ... puis
...
Paramétrage de mecab-ipadic (2.7.0-20070801+main-2.1) ...
Compiling IPA dictionary for Mecab. This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################|
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.

* * * * *
* * * * * on voit là qu'il y a un Not Found
* * * * *

reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipa
...
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
emitting double-array: 100% |###########################################|
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix : 100% |###########################################|

done!
update-alternatives: utilisation de « /var/lib/mecab/dic/ipadic » pour fournir « /var/lib/mecab/dic/debian » (mecab-dictionary) en mode automatique
Paramétrage de mysql-server-core-8.0 (8.0.23-0ubuntu0.20.04.1) ...
Paramétrage de mecab-ipadic-utf8 (2.7.0-20070801+main-2.1) ...
Compiling IPA dictionary for Mecab. This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################|
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
reading /usr/share/mecab/dic/i

* * * * *
* * * * * il refait 2 fois la même chose !
* * * * *

reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
emitting double-array: 100% |###########################################|
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix : 100% |###########################################|

done!
update-alternatives: utilisation de « /var/lib/mecab/dic/ipadic-utf8 » pour fournir « /var/lib/mecab/dic/debian » (mecab-dictionary) en mode automatique
Paramétrage de mysql-server-8.0 (8.0.23-0ubuntu0.20.04.1) ...
update-alternatives: utilisation de « /etc/mysql/mysql.cnf » pour fournir « /etc/mysql/my.cnf » (my.cnf) en mode automatique
Renaming removed key_buffer and myisam-recover options (if present)
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 12590
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Traitement des actions différées (« triggers ») pour systemd (245.4-4ubuntu3.6) ...
Traitement des actions différées (« triggers ») pour man-db (2.9.1-1) ...
Traitement des actions différées (« triggers ») pour libc-bin (2.31-0ubuntu9.3) ...
sylvie@sylvie-B85M-D3H ~ $

* * * * *
* * * * * j'ai ensuite essayé plein de commandes :
* * * * *

sylvie@sylvie-B85M-D3H:~$ mysql --user=root mysql
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

sylvie@sylvie-B85M-D3H:~$ dpkg-reconfigure mysql-server-8.0
/usr/sbin/dpkg-reconfigure doit être lancé par le superutilisateur

sylvie@sylvie-B85M-D3H:~$ sudo dpkg-reconfigure mysql-server-8.0
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 15389

sylvie@sylvie-B85M-D3H:~$ mysql -u -p
ERROR 1045 (28000): Access denied for user '-p'@'localhost' (using password: NO)

sylvie@sylvie-B85M-D3H:~$ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

sylvie@sylvie-B85M-D3H:~$ sudo mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> GRANT ALL PRIVILEGES ON *.* TO sylvie@localhost IDENTIFIED BY "xxxxxxx";
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY "mdpasse"' at line 1

* * * * *
* * * * * même commande avec des " au lieu des ' pour mdpasse
* * * * *

mysql> GRANT ALL PRIVILEGES ON *.* TO sylvie@localhost IDENTIFIED BY 'xxxxxxx';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'mdpasse'' at line 1

Ensuite j'ai essayé :

sylvie@sylvie-B85M-D3H:~$ sudo mysql
[sudo] Mot de passe de sylvie :
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> GRANT ALL PRIVILEGES ON *.* TO sylvie@localhost IDENTIFIED BY "xxxxxxx";
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY "mdpasse"' at line 1

mysql> select user from mysql.user;
+------------------+
| user |
+------------------+
| debian-sys-maint |
| mysql.infoschema |
| mysql.session |
| mysql.sys |
| root |
+------------------+
5 rows in set (0.00 sec)

mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql>

* * * * *
* * * * * et encore
* * * * *

sylvie@sylvie-B85M-D3H:~$ mysql -u sylvie -p
Enter password:
ERROR 1045 (28000): Access denied for user 'sylvie'@'localhost' (using password: YES)

sylvie@sylvie-B85M-D3H:~$ mysql --sylvie=root mysql
mysql: [ERROR] unknown variable 'sylvie=root'.

sylvie@sylvie-B85M-D3H:~$ dpkg-reconfigure mysql-server-8.0
/usr/sbin/dpkg-reconfigure doit être lancé par le superutilisateur

sylvie@sylvie-B85M-D3H:~$ sudo dpkg-reconfigure mysql-server-8.0
[sudo] Mot de passe de sylvie :
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 3140

sylvie@sylvie-B85M-D3H:~$ mysql
ERROR 1045 (28000): Access denied for user 'sylvie'@'localhost' (using password: NO)

sylvie@sylvie-B85M-D3H:~$ mysql -u sylvie -p
Enter password:
ERROR 1045 (28000): Access denied for user 'sylvie'@'localhost' (using password: YES)

sylvie@sylvie-B85M-D3H:~$ sudo mysql -u sylvie -p
[sudo] Mot de passe de sylvie :
Enter password:
ERROR 1045 (28000): Access denied for user 'sylvie'@'localhost' (using password: YES)

sylvie@sylvie-B85M-D3H:~$ mysql -u -p
ERROR 1045 (28000): Access denied for user '-p'@'localhost' (using password: NO)

sylvie@sylvie-B85M-D3H:~$ sudo mysql -pmdpasse
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> create user 'sylvie'@localhost by 'mdpasse';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by 'mdpasse'' at line 1
mysql> exit
Bye

sylvie@sylvie-B85M-D3H:~$ mysql -usylvie -p
Enter password:
ERROR 1045 (28000): Access denied for user 'sylvie'@'localhost' (using password: YES)

sylvie@sylvie-B85M-D3H:~$ sudo mysql -usylvie -p
Enter password:
ERROR 1045 (28000): Access denied for user 'sylvie'@'localhost' (using password: YES)

sylvie@sylvie-B85M-D3H:~$ sudo mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> create user 'sylvie'@localhost by 'mdpasse'
->
-> EXIT
-> GRANT ALL PRIVILEGES ON *.* TO 'sylvie';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by 'mdpasse'

EXIT
GRANT ALL PRIVILEGES ON *.* TO 'sylvie'' at line 1
mysql> GRANT ALL PRIVILEGES ON *.* to 'sylvie';
ERROR 1410 (42000): You are not allowed to create a user with GRANT

mysql> select user from mysql.user;
+------------------+
| user |
+------------------+
| debian-sys-maint |
| mysql.infoschema |
| mysql.session |
| mysql.sys |
| root |
+------------------+
5 rows in set (0.00 sec)

mysql> exit
Bye

sylvie@sylvie-B85M-D3H:~$ sudo mysql
[sudo] Mot de passe de sylvie :
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> create user 'sylvie'@localhost by 'xxxxxxx';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by 'mdpasse'' at line 1
mysql>
mysql> exit
Bye

* * * * *
* * * * * essai suppression et ré-install mysql
* * * * *

sylvie@sylvie-B85M-D3H:~$ sudo apt remove mysql-server-8.0
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
libevent-core-2.1-7 libevent-pthreads-2.1-7 libhtml-template-perl libmecab2
mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-server-core-8.0
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
Les paquets suivants seront ENLEVÉS :
mysql-server-8.0
0 mis à jour, 0 nouvellement installés, 1 à enlever et 0 non mis à jour.
Après cette opération, 1 481 ko d'espace disque seront libérés.
Souhaitez-vous continuer ? [O/n] O
(Lecture de la base de données... 341112 fichiers et répertoires déjà installés.
)
Suppression de mysql-server-8.0 (8.0.23-0ubuntu0.20.04.1) ...
update-alternatives: utilisation de « /etc/mysql/my.cnf.fallback » pour fournir
« /etc/mysql/my.cnf » (my.cnf) en mode automatique

sylvie@sylvie-B85M-D3H:~$ sudo apt remove mysql-client-8.0
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Les paquets suivants ont été installés automatiquement et ne sont plus nécessaires :
libevent-core-2.1-7 libevent-pthreads-2.1-7 libhtml-template-perl libmecab2
mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-core-8.0
mysql-server-core-8.0
Veuillez utiliser « sudo apt autoremove » pour les supprimer.
Les paquets suivants seront ENLEVÉS :
mysql-client-8.0
0 mis à jour, 0 nouvellement installés, 1 à enlever et 0 non mis à jour.
Après cette opération, 169 ko d'espace disque seront libérés.
Souhaitez-vous continuer ? [O/n] O
(Lecture de la base de données... 341091 fichiers et répertoires déjà installés.
)
Suppression de mysql-client-8.0 (8.0.23-0ubuntu0.20.04.1) ...
Traitement des actions différées (« triggers ») pour man-db (2.9.1-1) ...

sylvie@sylvie-B85M-D3H:~$ sudo apt autoremove
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Les paquets suivants seront ENLEVÉS :
libevent-core-2.1-7 libevent-pthreads-2.1-7 libhtml-template-perl libmecab2
mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-core-8.0
mysql-server-core-8.0
0 mis à jour, 0 nouvellement installés, 9 à enlever et 0 non mis à jour.
Après cette opération, 246 Mo d'espace disque seront libérés.
Souhaitez-vous continuer ? [O/n] O
(Lecture de la base de données... 341076 fichiers et répertoires déjà installés.
)
Suppression de mysql-server-core-8.0 (8.0.23-0ubuntu0.20.04.1) ...
Suppression de libevent-pthreads-2.1-7:amd64 (2.1.11-stable-1) ...
Suppression de libevent-core-2.1-7:amd64 (2.1.11-stable-1) ...
Suppression de libhtml-template-perl (2.97-1) ...
Suppression de mecab-ipadic-utf8 (2.7.0-20070801+main-2.1) ...
update-alternatives: utilisation de « /var/lib/mecab/dic/ipadic » pour fournir «
 /var/lib/mecab/dic/debian » (mecab-dictionary) en mode automatique
Suppression de mecab-ipadic (2.7.0-20070801+main-2.1) ...
Suppression de mecab-utils (0.996-10build1) ...
Suppression de libmecab2:amd64 (0.996-10build1) ...
Suppression de mysql-client-core-8.0 (8.0.23-0ubuntu0.20.04.1) ...
Traitement des actions différées (« triggers ») pour man-db (2.9.1-1) ...
Traitement des actions différées (« triggers ») pour libc-bin (2.31-0ubuntu9.3) 
...
sylvie@sylvie-B85M-D3H:~$ sudo apt install mysql-server-8.0
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
Les paquets supplémentaires suivants seront installés :
libevent-core-2.1-7 libevent-pthreads-2.1-7 libhtml-template-perl libmecab2
mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-8.0
mysql-client-core-8.0 mysql-server-core-8.0
Paquets suggérés :
libipc-sharedcache-perl mailx tinyca
Les NOUVEAUX paquets suivants seront installés :
libevent-core-2.1-7 libevent-pthreads-2.1-7 libhtml-template-perl libmecab2
mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client-8.0
mysql-client-core-8.0 mysql-server-8.0 mysql-server-core-8.0
0 mis à jour, 11 nouvellement installés, 0 à enlever et 0 non mis à jour.
Il est nécessaire de prendre 0 o/30,3 Mo dans les archives.
Après cette opération, 248 Mo d'espace disque supplémentaires seront utilisés.
Souhaitez-vous continuer ? [O/n] O
Préconfiguration des paquets...
Sélection du paquet mysql-client-core-8.0 précédemment désélectionné.
(Lecture de la base de données... 340818 fichiers et répertoires déjà installés.
)

* * * * *
* * * * * on retrouve encore le Not Found
* * * * *

Paramétrage de mecab-ipadic (2.7.0-20070801+main-2.1) ...
Compiling IPA dictionary for Mecab. This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################|
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
...
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
emitting double-array: 100% |###########################################|
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix : 100% |###########################################|

done!
update-alternatives: utilisation de « /var/lib/mecab/dic/ipadic » pour fournir «
 /var/lib/mecab/dic/debian » (mecab-dictionary) en mode automatique
Paramétrage de mysql-server-core-8.0 (8.0.23-0ubuntu0.20.04.1) ...
Paramétrage de mecab-ipadic-utf8 (2.7.0-20070801+main-2.1) ...
Compiling IPA dictionary for Mecab. This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################|
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
...
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
emitting double-array: 100% |###########################################|
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix : 100% |###########################################|

done!
update-alternatives: utilisation de « /var/lib/mecab/dic/ipadic-utf8 » pour four
nir « /var/lib/mecab/dic/debian » (mecab-dictionary) en mode automatique
Paramétrage de mysql-server-8.0 (8.0.23-0ubuntu0.20.04.1) ...
update-alternatives: utilisation de « /etc/mysql/mysql.cnf » pour fournir « /etc
/mysql/my.cnf » (my.cnf) en mode automatique
mysqld will log errors to /var/log/mysql/error.log
mysqld is running as pid 7297
Traitement des actions différées (« triggers ») pour systemd (245.4-4ubuntu3.6) 
...
Traitement des actions différées (« triggers ») pour man-db (2.9.1-1) ...
Traitement des actions différées (« triggers ») pour libc-bin (2.31-0ubuntu9.3) 
...
sylvie@sylvie-B85M-D3H:~$ sudo mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> create user 'sylvie'@localhost by 'xxxxxxx';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by 'mdpasse' at line 1
mysql> exit
Bye

sylvie@sylvie-B85M-D3H:~$ sudo mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> create user 'sylvie'@localhost by 'xxxxxxx';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by 'mdpasse'' at line 1
mysql> exit
Bye

sylvie@sylvie-B85M-D3H:~$ sudo apt install mysql-client-8.0
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances
Lecture des informations d'état... Fait
mysql-client-8.0 est déjà la version la plus récente (8.0.23-0ubuntu0.20.04.1).
mysql-client-8.0 passé en « installé manuellement ».
0 mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.

sylvie@sylvie-B85M-D3H:~$ sudo mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.23-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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> create user 'sylvie'@localhost by 'xxxxxxx';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by 'mdpasse'' at line 1
mysql> GRANT ALL PRIVILEGES ON *.* TO sylvie@localhost IDENTIFIED BY 'xxxxxxx';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'mdpasse'' at line 1
mysql> ^C

* * * * *
* * * * *
Mysql est compliqué !!! enfin pour moi car à chaque installation je galère !
Merci d'avance pour toute aide.

(j'ai fait un instantané système avant, je vais donc le restaurer pour re-partir sur de bonnes bases ...)

Bonjour Sylvie,
Il y en a tellement que j'ai pas tout lu .... Mais pour installer mysql et un utilisateur voici la procédure :
sudo apt install mysql-server
sudo mysql
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost';
FLUSH PRIVILEGES;
exit

Pour installer gambas :
sudo apt install gambas3 gambas3-gb-sdl-sound gambas3-gb-form-print
Cela fonctionne sous Ubuntu 20.04, Neon, Debian il ne devait pas y avoir de problèmes avec Mint.