wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum localinstall -y mysql57-community-release-el7-7.noarch.rpm
yum install -y mysql-community-server
systemctl start mysqld.service
grep 'temporary password' /var/log/mysqld.log
用上面的密碼登陸mysql
SET PASSWORD = PASSWORD('your new password'); ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
或者 update mysql.user set authentication_string=password('123qwe') where user='root' and Host = 'localhost';
*特別提醒注意的一點是,新版的mysql下的user表中已經沒有Password字段了而是將加密後的用戶密碼存儲於authentication_string字段mysql
mysql> flush privileges;sql
mysql> quit;ide
建立用戶
//create user '173'@'%' identified by 'mima' password expire never;
CREATE USER 'username'@'host' IDENTIFIED BY 'password'
查看用戶
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
修改用戶密碼
set password for '17sf'@'%'=password('mima');
//grant all privileges on dbname.* to '173'@'%';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'your password' WITH GRANT OPTION;
yum remove mysql mysql-server mysql-libs compat-mysql51rm -rf /var/lib/mysqlrm /etc/my.cnf查看是否還有mysql軟件:rpm -qa|grep mysql有的話繼續刪除