MySQL&MariaDB设置远程访问

grant all privileges on . to ‘root’@’%’ identified by ‘19940722Fyy’ with grant option;

flush privileges;

Last login: Wed Sep 13 16:09:49 2023 from 127.0.0.1
[root@ecm-24d4 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.40-log Source distribution

Copyright (c) 2000, 2022, 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 ‘root’@’%’ IDENTIFIED BY ‘19940722Fyy’ WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql>
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql>

Leave a Reply

Your email address will not be published. Required fields are marked *