Linux安装Mysql
下载mysql的repo源
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
安装mysql-community-release-el7-5.noarch.rpm包
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
安装mysql
sudo yum install mysql-server
ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket
sudo chown -R openscanner:openscanner /var/lib/mysql
然后,重启服务
service mysqld restart
接下来登录重置密码
mysql -u root
mysql > use mysql;
mysql > update user set password=password('pencilso') where user='root';
mysql > exit;
开放3306端口
sudo vim /etc/sysconfig/iptables
添加以下内容
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
保存后重启防火墙
sudo service iptables restart