[root@wanzi ~]# docker exec -it 9ce83ece5d06 bash
root@9ce83ece5d06:/# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.27 MySQL Community Server - GPL
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> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' whth grant option;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server v ersion for the right syntax to use near 'identified by 'root' whth grant option' at line 1
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root' with mysql_native_password by '123456'
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server v ersion for the right syntax to use near 'identified by 'root' with mysql_native_password by '123456'' at line 1
mysql> grant all on *.* to 'root'@'%';
Query OK, 0 rows affected (0.01 sec)
mysql> alert user 'root'@'%' identified with mysql_native_password by '123456';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server v ersion for the right syntax to use near 'alert user 'root'@'%' identified with mysql_native_password by '123456'' at line 1
mysql>
mysql>
mysql> grant all privileges on *.* to "root"@"%" identified by "root" with grant option;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server v ersion for the right syntax to use near 'identified by "root" with grant option' at line 1
mysql> set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_ SUBSTITUTION';
Query OK, 0 rows affected (0.01 sec)
mysql> set session sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE _SUBSTITUTION';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>