yum install mysql 5.7

Posted x.radish

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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
有的话继续删除

以上是关于yum install mysql 5.7的主要内容,如果未能解决你的问题,请参考以下文章

CentOS 6.5/6.6 安装(install)mysql 5.7 最完整版教程

CentOS 6.5/6.6 安装mysql 5.7 最完整版教程

mysql低版本的主从复制和5.7版本的主从复制

安装MYSQL 8.0

Centos7使用yum命令安装Mysql

CentOS 7 下 Yum 安装 MySQL 5.7