• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

Linux + iptables + Mysql 初始配置_MySQL

mysql 搞代码 4年前 (2022-01-09) 21次浏览 已收录 0个评论

iptables

配置网卡

方法一:把以下命令放在/etc/rc.d/init.d/rc.local文件中

[root@local root]# ifconfig eth0 down <==关闭 eth0 网卡

[root@local root]# ifconfig eth0 up <==启动 eth0 网卡

[root@local root]# ifconfig eth0 192.168.0.2 netmask 255.255.255.0

[root@local root]# route add default gw 192.168.1.2

方法二:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=static

IPADDR=219.136.241.211

NETMASK=255.255.255.128

GATEWAY=192.168.1.1

vi /etc/resolv.conf

nameserver 8.8.8.8

/etc/init.d/network restart

配置防火墙

[root@local root]# vi /etc/sysconfig/iptables

[root@local root]# service iptables restart

yum安装mysql

[root@local root]# yum list | grep mysql

[root@local root]# yum list | grep mysql-server

/sbin/chkconfig –-add mysqld [在服务清单中添加mysql服务]

service mysqld start;(即/etc/init.d/mysqld start。也可设成开机自启动:/sbin/chkconfi本文来源gaodai#ma#com搞*!代#%^码$网!g mysqld on)

更改 root 密码: mysqladmin -u root password ‘newpassword’

添加mysql用户: GRANT ALL PRIVILEGES ON *.* TO ‘user’@’localhost’ IDENTIFIED BY ‘password’;

grant all on *.* to “root”@”%” identified by “123456”;

(update user set host = ’%’ where user = ’root’;)

重载权限: mysql> FLUSH PRIVILEGES;

删除test数据库: mysql -u root -p mysql> DROP DATABASE test;

删除匿名帐户: DELETE FROM mysql.user WHERE user = ”;

关机

shutdown -h now

Windows

route change 0.0.0.0 mask 0.0.0.0 192.168.1.1


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Linux + iptables + Mysql 初始配置_MySQL

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址