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

MariaDB [hellodb]> GRANT ALL PRIVILEGES ON hellodb.* TO magedu@'192.168.1.%' IDENTIFIED BY 'centos';
MariaDB [hellodb]> FLUSH PRIVILEGES;
MariaDB [hellodb]> SHOW GRANTS FOR magedu@'192.168.1.%';
+-----------------------------------------------------------------------------------------------------------------+
| Grants for magedu@192.168.1.%                                                                                   |
+-----------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `magedu`@`192.168.1.%` IDENTIFIED BY PASSWORD '*128977E278358FF80A246B5046F51043A2B1FCED' |
| GRANT ALL PRIVILEGES ON `hellodb`.* TO `magedu`@`192.168.1.%`                                                   |
+-----------------------------------------------------------------------------------------------------------------+

[root@centos7 ~]#ip a a 192.168.1.0/24 dev eth0
[root@centos7 ~]#mysql -umagedu -h192.168.1.0 -pcentos -Dhellodb
MariaDB [hellodb]> status
--------------
mysql  Ver 15.1 Distrib 10.4.22-MariaDB, for Linux (x86_64) using readline 5.1

Connection id:		11
Current database:	hellodb
Current user:		magedu@192.168.1.0
SSL:			Not in use
Current pager:		stdout
Using outfile:		''
Using delimiter:	;
Server:			MariaDB
Server version:		10.4.22-MariaDB MariaDB Server
Protocol version:	10
Connection:		192.168.1.0 via TCP/IP
Server characterset:	utf8
Db     characterset:	utf8
Client characterset:	utf8
Conn.  characterset:	utf8
TCP port:		3306
Uptime:			17 min 36 sec




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一直在努力学习的菜鸟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值