yum install mysql 5.7

 

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> flush privileges;

mysql> quit;



创建用户
//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-mysql51
rm -rf /var/lib/mysql
rm /etc/my.cnf
查看是否还有mysql软件:
rpm -qa|grep mysql
有的话继续删除
posted @ 2017-06-26 11:00  x.radish  阅读(243)  评论(0编辑  收藏  举报