mysql5.7.21 RPM 安装

mysql 2018-06-25 浏览(1987 评论(0

1.环境

    CentOS-6.9-i386-minimal.iso
    

2.mysql 5.7,下载mysql(https://dev.mysql.com/downloads/mysql/)

    tar -xvf mysql-5.7.21-1.el6.i686.rpm-bundle.tar
    
    mysql-community-client-5.7.21-1.el6.i686.rpm
    mysql-community-common-5.7.21-1.el6.i686.rpm
    mysql-community-devel-5.7.21-1.el6.i686.rpm
    mysql-community-embedded-5.7.21-1.el6.i686.rpm
    mysql-community-embedded-devel-5.7.21-1.el6.i686.rpm
    mysql-community-libs-5.7.21-1.el6.i686.rpm
    mysql-community-libs-compat-5.7.21-1.el6.i686.rpm
    mysql-community-server-5.7.21-1.el6.i686.rpm
    mysql-community-test-5.7.21-1.el6.i686.rpm
    
    主要是安装以下四个(按顺序安装):
    mysql-community-common-5.7.21-1.el6.i686.rpm
    mysql-community-libs-5.7.21-1.el6.i686.rpm
    mysql-community-client-5.7.21-1.el6.i686.rpm
    mysql-community-server-5.7.21-1.el6.i686.rpm
    

3、删除已安装mysql 包

1.列出mysql安装包
    rpm -qa|grep mysql
    
    mysql-libs-5.1.66-2.el6_3.i686
    
2.删除安装包

    yum remove mysql-libs-5.1.66-2.el6_3.i686 -y

4、使用rpm 命令安装(注意安装顺序)

安装依赖:

    yum install perl -y
    
    yum install libnuma* -y
    
安装mysql

rpm -hiv mysql-community-client-5.7.21-1.el6.i686.rpm
rpm -hiv mysql-community-libs-5.7.21-1.el6.i686.rpm
rpm -hiv mysql-community-client-5.7.21-1.el6.i686.rpm
rpm -hiv mysql-community-server-5.7.21-1.el6.i686.rpm

4、启动mysql(初始化mysql)

/etc/rc.d/init.d/mysqld start

5、查看mysql5.7默认的密码

cat /var/log/mysqld.log|grep 'temporary password'

2018-03-13T09:28:49.833634Z 1 [Note] A temporary password is generated for root@localhost: sBehPhNr%2dR

初始密码为:sBehPhNr%2dR

6、登录

mysql -uroot -p

登录之后修改密码(mysql密码有安全要求,要求有大小写特殊字符)
mysql> SET PASSWORD = PASSWORD('Abc123!@');

7、授权远程连接

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Abc123!@#' WITH GRANT OPTION;
mysql>FLUSH   PRIVILEGES;

说明:如果远程连接不上,关闭防火墙。

打赏

如果此文对你有所帮助,请随意打赏鼓励作者^_^

黄信强博客

加个好友,学习交流

黄信强博客

微信公众号

黄信强博客

微信