MySQL 5.7.21 binary installation on the OEL6.9 platform

Source: Internet
Author: User
Tags deprecated

  • Prerequisite Preparation (shutdown firewall, selinux, install Libaio)
    shell> chkconfig --level 2345 iptables offshell> service iptables stopshell> vi /etc/selinux/configSELINUX=disabled
  • shell> Yum Install Libaio

    1. 配置用户属组 (MySQL用户不需要登录操作系统)

    shell> Groupadd MySQL
    Shell> Useradd-r-G mysql-s/bin/false MySQL

    2. 解压二进制软件

    Shell> cd/usr/local
    Shell> mv ~/mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz./

    Shell> Tar zxvf mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz
    Or
    Shell> Gunzip < mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz | Tar xvf-

    shell> MV Mysql-5.7.21-linux-glibc2.12-x86_64 mysql-5.7.21

    3. 修改软件权限创建链接

    Shell> chmod-r./mysql-5.7.21
    Shell> chown-r mysql:mysql./mysql-5.7.21
    shell> ln-s/usr/local/mysql-5.7.21 MySQL

    4. 创建MySQL数据目录 (提前touch日志文件,否则启动的时候会报错)

    Shell> mkdir-p/mysql/{data,log,binlog}
    Shell> Chown-r mysql:mysql/mysql/
    Shell> Touch/mysql/log/mysqld.log
    Shell> Chown Mysql:mysql/mysql/log/mysqld.log

    5. 编辑数据库服务器参数 (指定数据初始化目录,也可以通过命令行指定初始化目录)

    Shell> vi/etc/my.cnf
    [Mysqld]
    Datadir=/mysql/data
    Socket=/mysql/log/mysql.sock

    [Mysqld_safe]
    Log_error=/mysql/log/mysqld.log
    Pid_file=/mysql/log/mysqld.pid

    6. 初始化数据库

    shell> CD MySQL
    Shell> bin/mysqld--initialize--user=mysql (m3gfb<1gkdz%)
    Shell> Bin/mysql_ssl_rsa_setup
    Shell> Bin/mysqld_safe--user=mysql &

    7. 修改默认root口令

    [Email protected] mysql]# mysql-u root-p-s/mysql/log/mysql.sock
    Mysql> ALTER USER ' root ' @ ' localhost ' identified by ' Oracle ';
    mysql> FLUSH privileges;

    8. 关闭数据库`[[email protected] mysql]# bin/mysqladmin -u root -p -S /mysql/log/mysql.sock shutdown`9. 修改环境变量

    Shell> VI ~/.bash_profile
    Export Path=/usr/local/mysql/bin: $PATH
    Export mysql_ps1= "(\[email protected]\h) [\d]>"

    [Email protected] mysql]#. ~/.bash_profile

    10. 配置MySQL服务

    shell> CP Support-files/mysql.server/etc/init.d/mysql
    shell> chkconfig--add MySQL
    shell> chkconfig--level 2345 MySQL on

    11. 编辑数据库客户端参数

    [Client]
    Host=localhost
    User=root
    Password=oracle
    Socket=/mysql/log/mysql.sock

    12. 启动MySQL服务`shell> service mysql start`13. 登录数据库验证

    shell> MySQL
    ([email protected]) [(None)]> show databases;

    2018-03-15t13:38:06.902460z 0 [ERROR] SSL error:unable to get private key from ' Server-key.pem '
    2018-03-15t13:38:06.902470z 0 [Warning] Failed to set up SSL because of the following SSL library error:unable to get PRI Vate Key

    MySQL user does not have permission to access ' SERVER-KEY.PEM ' file, modify permissions after error resolved:
    [Email protected] security]# cd/mysql/data/
    [Email protected] data]# Ls-la SERVER-KEY.PEM
    -RW-------1 root root 1679 Mar 21:24 Server-key.pem
    [Email protected] data]# chmod 644 SERVER-KEY.PEM
    [[Email protected] data]# service MySQL restart

    2018-03-15t14:29:38.605619z 0 [Note] Found Ca.pem, SERVER-CERT.PEM and Server-key.pem in Data directory. Trying to enable SSL support using them.
    Null

    2.
    2018-03-15t13:38:06.767757z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_time
    Stamp server option (see documentation for more details).

    Resolve the alarm by setting the parameters:
    Explicit_defaults_for_timestamp=1

    Note
    Explicit_defaults_for_timestamp is itself deprecated because it only purpose are to permit control over deprecated Timesta MP behaviors that is to being removed in a future MySQL release. When removal of those behaviors occurs, Explicit_defaults_for_timestamp would have no purpose and would be removed as well.

    MySQL 5.7.21 binary installation on the OEL6.9 platform

    Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.