非原创,记录。
1. 下载mysql的repo源
1 wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2 sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
3. 安装mysql
$sudo yum install mysql-server
4. 重置密码
$ mysql -u root
$sudo chown-R root:root/var/lib/mysql
$ service mysqld restart
$ mysql -u root
3mysql > use mysql;
mysql > update usersetpassword=password(‘123456‘) where user=‘root‘;
mysql >exit;
first check status:
netstat -tulpen
modify your configuration :
vi/etc/mysql/my.cnf
bind-address=0.0.0.0
entry mysql to give privileges
GRANTALLPRIVILEGESON*.*TO'myuser'@'%'IDENTIFIEDBY'mypassword'WITHGRANTOPTION;FLUSH PRIVILEGES;
restart mysql
/etc/init.d/mysql restart