首頁 >資料庫 >mysql教程 >Linux + iptables + Mysql 初始配置_MySQL

Linux + iptables + Mysql 初始配置_MySQL

WBOY
WBOY原創
2016-06-01 13:11:20929瀏覽

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