数据库授权magedu用户,允许192.168.1.0/24网段可以连接mysql

 

MariaDB [hellodb]> create user 'magedu'@'192.168.1.%' ;
Query OK, 0 rows affected (0.011 sec)

MariaDB [hellodb]> grant all privileges on hellodb.* to 'magedu'@'192.168.1.%' ;
Query OK, 0 rows affected (0.001 sec)

因没有设置密码,连接时空密码
[root@localhost ~]# mysql -umagedu -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.4.21-MariaDB MariaDB Server

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)]>

 

posted @ 2021-11-04 15:54  小糊涂90  阅读(36)  评论(0编辑  收藏  举报