2022-10-27 367
问:怎样才能指定MySQL只监听某个特定地址?
答:比较常见的办法是,在my.cnf之mysqld节,添加bind-address=127.0.0.1。但是也有人按照下面的办法来做。
为了数据的安全,可以考虑让MySQL只守候在127.0.0.1上,这样从Internet上就无法直接访问数据库了。修改/etc/init.d/mysql文件,在start部分找到类似下面这行:
$bindir/mysqld_safe –datadir=$datadir
–pid-file=$pid_file &
修改成:
$bindir/mysqld_safe –datadir=$datadir
–pid-file=$pid_file –bind-address=127.0.0.1 &
重起MySQL:
/etc/init.d/mysql restart
最后netstat -l确认一下:
tcp 0 0 localhost:mysql *:* LISTEN
原文链接:https://77isp.com/post/4173.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态