rpm -qa|grep -i mysql 查看是否有mysql相关文件

CentOS 7.4下使用yum安装MySQL


  yum -y remove mysql-community-client-5.6.38-2.el7.x86_64

  依次卸载

  [[email protected] mysql]# wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm 

   [[email protected] mysql]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm 

   [[email protected] mysql]#  yum -y install mysql-server 

CentOS 7.4下使用yum安装MySQL


配置文件:/etc/my.cnf 

安装完成后,密码为随机密码,需要修改密码。

[[email protected] ~]# grep "password" /var/log/mysqld.log 

CentOS 7.4下使用yum安装MySQL


 在安装的过程中发现找不到密码          修改MySQL的登录设置:

#vi /etc/my.cnf
在[mysqld]的段中加上一句:skip-grant-tables 保存并且退出vi。
重新启动mysqld

重新启动mysqld
# service mysqld restart
use mysql 
update user set password=password("xxxxxx") where user="root";
mysql 5.7的数据库没有了password字段 用的是authentication_string字段
mysql> update mysql.user set authentication_string=password('root') where user='root' ;
flush privileges;

相关文章: