当前位置:Gxlcms > mysql > Linux+iptables+Mysql初始配置_MySQL

Linux+iptables+Mysql初始配置_MySQL

时间:2021-07-01 10:21:17 帮助过:18人阅读

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/chkconfig 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

人气教程排行