>  기사  >  데이터 베이스  >  Linux + iptables + Mysql 初始配置_MySQL

Linux + iptables + Mysql 初始配置_MySQL

WBOY
WBOY원래의
2016-06-01 13:11:20886검색

iptables

配置网卡

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

[root@local  root]# ifconfig eth0 down    

[root@local  root]# ifconfig eth0 up        

[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

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.