輸入命令 :yum list installed | grep MySQLmysql
輸入命令:yum -y remove mysqlsql
看到complete就說明成功了
vim
輸入命令:yum list | grep mysqlsocket
輸入命令: yum -y install mysql mysql-server mysql-develtcp
輸入命令:rpm -qi mysql-serverspa
輸入命令:service mysqld start.net
輸入命令:mysql -u rootrest
若是出現ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ 錯誤,多是服務未開啓,也多是/var/lib/mysql的訪問權限問題。
若是是服務未開啓:service mysqld start
若是是訪問權限問題:chown -R openscanner:openscanner /var/lib/mysqlserver
mysql > use mysql;
mysql > update user set password=password(‘123456‘) where user=‘root‘;blog
mysql -u root -p
輸入命令:GRANT ALL PRIVILEGES ON * . * TO ‘root’@’%’ IDENTIFIED BY ‘你的密碼’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
輸入命令:vim /etc/sysconfig/iptables
添加:-A INPUT -p tcp -m state –state NEW -m tcp –dport 3306 -j ACCEPT
而後重啓 防火牆:service iptables restart
chkconfig mysqld on