mysql 安装过程记录

mysql 本地rpm包安装

1.首先卸载centos7中自带的mariadb
    rpm -qa|grep mariadb //查询出来已安装的mariadb
    rpm -e --nodeps mariadb-libs-5.5.60-1.el7_5.x86_64 //卸载mariadb,文件名为上述命令查询出来的文件
2.卸载旧版本的Mysql
    rpm -qa | grep -i mysql //查找
    rpm -e  mysql80-community-release-el7-3.noarch //删除
3.删除mysql分散的文件夹
    whereis mysql                             //查出相应的mysql文件夹,也可以用find / -name *mysql*                   
    rm -rf /use/lib/mysql      //删除

    find / -name mysql
    rm -rf /etc/selinux/targeted/active/modules/100/mysql
4.安装(下载好的rpm包本地安装)
    1. 解压 mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar
        tar -xvf mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar

            mysql-community-client-8.0.19-1.el7.x86_64.rpm
        mysql-community-common-8.0.19-1.el7.x86_64.rpm
        mysql-community-devel-8.0.19-1.el7.x86_64.rpm
        mysql-community-embedded-compat-8.0.19-1.el7.x86_64.rpm
        mysql-community-libs-8.0.19-1.el7.x86_64.rpm
        mysql-community-libs-compat-8.0.19-1.el7.x86_64.rpm
        mysql-community-server-8.0.19-1.el7.x86_64.rpm
        mysql-community-test-8.0.19-1.el7.x86_64.rpm
    2. 按照下面的顺序安装        
        rpm -ivh mysql-community-common-8.0.19-1.el7.x86_64.rpm
        rpm -ivh mysql-community-libs-8.0.19-1.el7.x86_64.rpm
        rpm -ivh mysql-community-client-8.0.19-1.el7.x86_64.rpm
        rpm -ivh mysql-community-server-8.0.19-1.el7.x86_64.rpm 

5.初始化实例
    1.修改配置文件 /etc/my.cnf

    [mysqld]
    datadir=/data/mysql/3307/data
    2.创建 /data/mysql/3307 目录, 修改权限 chown mysql.mysql  /data/mysql/3307

    3.初始化 
        mysqld --initialize --user=mysql   
        其中 --user=mysql 指 用mysql用户进行初始化
    4.启动
        mysqld --user=mysql &
    5.连接
        mysql -uroot  -p
        密码在log-error中找
    6修改root的密码
        ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';

        create user 'root'@'%' identified by 'root';
        grant all privileges on *.* to 'root'@'%' with grant option;
        flush privileges;            
    现在可以远程登录了。    
上一篇:mysql 5.7主从配置记录


下一篇:日志分析logstash插件-grok详解