1. Remove mysql
yum remove mysql mysql-server mysql-libs mysql-server;
find / -name mysql will find something related to delete off (rm -rf / var / lib / mysql);
rpm -qa | grep mysql (check out the stuff yum remove off)
2. Download wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
3.安装 rpm -ivh mysql-community-release-el6-5.noarch.rpm
yum update yum install mysql-server (where there is an error *** Requires: libc.so.6 (GLIBC_2.17) (64bit) ***)
solve:
3.1、yum install glibc.i686
3.2、yum list libstdc++*
3.3, /etc/yum.repos.d/ CD #
# sudo VI MySQL-community.repo
find mysql-56-community
will enable is set to 0 enable = 0
reinstall mysql sudo yum install mysql-server
4. View mysql status ---- /etc/rc.d/init.d/mysqld status
Start mysql ---- / etc / rc.d / init.d / mysqld start
Log ----- mysql -u root -p password empty
修改密码 use mysql; UPDATE user SET password=PASSWORD('123456') WHERE user='root';
Refresh ---- flush privileges; quit exit;
The open port 3306, vi / etc / sysconfig / iptables
添加-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
Restart service iptables restart
6. may be unable to connect remote
Login use mysql;
Queries root and host relationship select Host, User from user;
Modified update user set Host = '%' where User = 'root' limit 3; ----% represents any
There may be an error ---- ERROR 1062 (23000): Duplicate entry '% -root' for key 'PRIMARY'
Skip, execute flush privileges; quit
Restart mysql ---- service mysqld restart (I do not have to restart can be visited).
Related reference: https://www.cnblogs.com/nucdy/p/5784809.html
http://www.runoob.com/mysql/mysql-install.html
https://blog.csdn.net/qq_32851561/article/details/81146314
https://blog.csdn.net/hello_world_qwp/article/details/79544162