返回顶部
首页 > 资讯 > 数据库 >RHEL 7.2如何安装二进制MySQL 5.7.18
  • 844
分享到

RHEL 7.2如何安装二进制MySQL 5.7.18

2024-04-02 19:04:59 844人浏览 安东尼
摘要

这篇文章给大家分享的是有关RHEL 7.2如何安装二进制Mysql 5.7.18的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。环境:Red Hat Enterprise linu

这篇文章给大家分享的是有关RHEL 7.2如何安装二进制Mysql 5.7.18的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

环境:

Red Hat Enterprise linux Server release 7.2 (Maipo)

mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

安装需求:

libaio

Mysql 5.7.19 and later 需要安装libnuma,由于本次测试为5.7.18,不需要安装libnuma.

如之前安装过MySQL,清除一下目录和文件

/etc/my.cnf or the /etc/mysql

rhel7以后需要取消RemoveIPC限制

[root@rhelb mysql]# vi /etc/systemd/logind.conf

#RemoveIPC=yes -> RemoveIPC=no

检查软件包是否安装

[root@rhelb mysql]# rpm -qa | grep libaio

关闭防火墙

[root@rhelb yum.repos.d]# vi /etc/sysconfig/selinux 

SELINUX=enforcing-> SELINUX=disabled

关闭系统THP,rhel7以后和之前关闭THP文件有变化,rhel7及以后关闭方式如下:

[root@rhelb yum.repos.d]# cat /sys/kernel/mm/transparent_hugepage/enabled 

[always] madvise never

在quiet后添加 transparent_hugepage=never

[root@rhelb yum.repos.d]# cat /etc/default/grub 

GRUB_TIMEOUT=5

GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"

GRUB_DEFAULT=saved

GRUB_DISABLE_SUBMENU=true

GRUB_TERMINAL_OUTPUT="console"

GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet transparent_hugepage=never"

GRUB_DISABLE_RECOVERY="true"

添加后重启主机

[root@rhelb yum.repos.d]# cat /sys/kernel/mm/transparent_hugepage/enabled 

always madvise [never]

配置yum源,rhel7以后,新建一个新的yum资料库

[root@rhelb mysql]# mount /dev/sr0 /mnt

[root@rhelb yum.repos.d]# ls -lrt

total 8

-rw-r--r--. 1 root root  91 Aug 16 23:11 rhel.repo

-rw-r--r--. 1 root root 358 Aug 16 23:12 redhat.repo

[root@rhelb yum.repos.d]# more /etc/yum.repos.d/rhel.repo 

[rhel7_server]

name=added from: file:///rhel7/dvd

baseurl=file:///mnt

enabled=1

gpGCheck=0

安装软件包:

[root@rhelb mysql]# yum -y install libaio.x86_64

......

Installed:

  libaio.x86_64 0:0.3.109-13.el7                                                                                                    

Complete!

MySQL二进制目录说明:

DirectoryContents of Directory
binmysqld server, client and utility programs
docsMySQL manual in Info fORMat
manUnix manual pages
includeInclude (header) files
libLibraries
shareError messages, dictionary, and SQL for database installation
support-filesMiscellaneous support files

解压软件:

[root@rhelb soft]# tar -xzvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz 

[root@rhelb soft]# mv mysql-5.7.18-linux-glibc2.5-x86_64 /usr/local/mysql

创建相关用户:

[root@rhelb mysql]# groupadd mysql

[root@rhelb mysql]# useradd -r -g mysql -s /bin/false mysql

[root@rhelb mysql]# cd /usr/local

[root@rhelb local]# mkdir /data

[root@rhelb local]# chown -R mysql:mysql /usr/local/mysql/

[root@rhelb local]# chown -R mysql:mysql /data/

[root@rhelb local]# chmod 750 /data/

初始化数据库

查看mysqld参数:

root@rhelb mysql]# bin/mysqld --verbose --help |more

mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2 - No such file or directory)

bin/mysqld  Ver 5.7.18 for linux-glibc2.5 on x86_64 (MySQL CommUnity Server (GPL))

Copyright (c) 2000, 2017, oracle and/or its affiliates. All rights reserved.

Oracle is a reGIStered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Starts the MySQL database server.

Usage: bin/mysqld [OPTIONS]

Default options are read from the following files in the given order:

/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf 

The following groups are read: mysqld server mysqld-5.7

The following options may be given as the first argument:

......

[root@rhelb mysql]# ./bin/mysqld --initialize --user=mysql --basedir=/data/ --datadir=/data/

2018-08-21T09:11:34.367385Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2018-08-21T09:11:34.367604Z 0 [ERROR] Can't find error-message file '/data/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.

2018-08-21T09:11:34.632615Z 0 [Warning] InnoDB: New log files created, LSN=45790

2018-08-21T09:11:34.705037Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2018-08-21T09:11:34.997455Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 33b8197c-a522-11e8-83a6-080027073030.

2018-08-21T09:11:35.001885Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2018-08-21T09:11:35.004186Z 1 [Note] A temporary passWord is generated for root@localhost: kdivr2ax2P,K

root初始化密码kdivr2ax2P,K

[root@rhelb mysql]# ls -lrt /data/

total 110628

-rw-r----- 1 mysql mysql 50331648 Aug 21 05:11 ib_logfile1

-rw-r----- 1 mysql mysql       56 Aug 21 05:11 auto.cnf

drwxr-x--- 2 mysql mysql     8192 Aug 21 05:11 performance_schema

drwxr-x--- 2 mysql mysql     4096 Aug 21 05:11 mysql

drwxr-x--- 2 mysql mysql     8192 Aug 21 05:11 sys

-rw-r----- 1 mysql mysql      419 Aug 21 05:11 ib_buffer_pool

-rw-r----- 1 mysql mysql 50331648 Aug 21 05:11 ib_logfile0

-rw-r----- 1 mysql mysql 12582912 Aug 21 05:11 ibdata1

配置ssl,会话安全方面考虑,如不需要可以不配置

[root@rhelb mysql]# bin/mysql_ssl_rsa_setup

Generating a 2048 bit RSA private key

.................................+++

...+++

writing new private key to 'ca-key.pem'

-----

Generating a 2048 bit RSA private key

..........................................................................+++

.+++

writing new private key to 'server-key.pem'

-----

Generating a 2048 bit RSA private key

..............................+++

..................................................................+++

writing new private key to 'client-key.pem'

配置参数文件,如果不配置[client]客户端连接时提示/tmp/Socket.sock

[root@rhelb etc]# vi /etc/my.cnf

[mysqld]

port = 3306

pid-file = /data/mysql3306.pid

datadir = /data/

socket = /data/mysql3306.sock

slow_query_log_file = /data/slow.log

log-error = /data/error.log

[client]

socket = /data/mysql3306.sock   

MySQL取消安全隐患:

 a)为root用户设置密码
  b)删除匿名账号
  c)取消root用户远程登录
  d)删除test库和对test库的访问权限
  e)刷新授权表使修改生效

root@rhelb mysql]# bin/mysql_secure_installation 

Securing the MySQL Server deployment.

Enter password for user root: 

Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

[root@rhelb mysql]# bin/mysql_secure_installation -S /data/mysql3306.sock

Securing the MySQL server deployment.

Enter password for user root: 

Error: Access denied for user 'root'@'localhost' (using password: NO)

[root@rhelb mysql]# bin/mysql_secure_installation -S /data/mysql3306.sock

Securing the MySQL server deployment.

Enter password for user root:       <<——日志中临时生成的密码

The existing password for the user account root has expired. Please set a new password.

New password: 

Re-enter new password: 

VALIDATE PASSWORD PLUGIN can be used to test passwords

and improve security. It checks the strength of password

and allows the users to set only those passwords which are

secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: Y

There are three levels of password validation policy:

LOW    Length >= 8

MEDIUM Length >= 8, numeric, mixed case, and special characters

STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1

Using existing password for root.

Estimated strength of the password: 100 

Change the password for root ? ((Press y|Y for Yes, any other key for No) :    

 ... skipping.

By default, a MySQL installation has an anonymous user,

allowing anyone to log into MySQL without having to have

a user account created for them. This is intended only for

testing, and to make the installation Go a bit smoother.

You should remove them before moving into a production

environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y

Success.

Normally, root should only be allowed to connect from

'localhost'. This ensures that someone cannot guess at

the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y

Success.

By default, MySQL comes with a database named 'test' that

anyone can access. This is also intended only for testing,

and should be removed before moving into a production

environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y

 - Dropping test database...

Success.

 - Removing privileges on test database...

Success.

Reloading the privilege tables will ensure that all changes

made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y

Success.

All done! 


配置服务启动:

[root@rhelb mysql]# cp support-files/mysql.server /etc/init.d/

[root@rhelb mysql]# service mysql.server start

Starting MySQL. SUCCESS! 

[root@rhelb mysql]# ps -ef | grep mysql

root      3486     1  0 05:51 pts/2    00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/ --pid-file=/data/mysql3306.pid

mysql     3653  3486  6 05:51 pts/2    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/error.log --pid-file=/data/mysql3306.pid --socket=/data/mysql3306.sock --port=3306

root      3685  2711  0 05:51 pts/2    00:00:00 grep --color=auto mysql

[root@rhelb etc]# mysql -uroot -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.7.18 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> status;

--------------

mysql  Ver 14.14 Distrib 5.7.18, for linux-glibc2.5 (x86_64) using  EditLine wrapper

Connection id:          4

Current database:

Current user:           root@localhost

SSL:                    Not in use

Current pager:          stdout

Using outfile:          ''

Using delimiter:        ;

Server version:         5.7.18 MySQL Community Server (GPL)

Protocol version:       10

Connection:             Localhost via UNIX socket

Server characterset:    latin1

Db     characterset:    latin1

Client characterset:    utf8

Conn.  characterset:    utf8

UNIX socket:            /data/mysql3306.sock

Uptime:                 12 sec

Threads: 1  Questions: 6  Slow queries: 0  Opens: 105  Flush tables: 1  Open tables: 98  Queries per second avg: 0.500

感谢各位的阅读!关于“RHEL 7.2如何安装二进制MySQL 5.7.18”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

您可能感兴趣的文档:

--结束END--

本文标题: RHEL 7.2如何安装二进制MySQL 5.7.18

本文链接: https://lsjlt.com/news/62597.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
  • RHEL 7.2如何安装二进制MySQL 5.7.18
    这篇文章给大家分享的是有关RHEL 7.2如何安装二进制MySQL 5.7.18的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。环境:Red Hat Enterprise Linu...
    99+
    2024-04-02
  • 如何安装MySQL二进制包
    本篇内容介绍了“如何安装MySQL二进制包”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!一、安装说明本文使...
    99+
    2024-04-02
  • Mysql二进制安装
    Mysql安装安装步骤1、新建用户groupadd mysqluseradd -r -g mysql mysqlcd /usr/local/----------------------------注意路径c...
    99+
    2024-04-02
  • MySQL 5.7.22 二进制安装
    MySQL 5.7.22 二进制安装 一、到官网下载mysql-5.7.22二进制包 二、创建mysql用户: useradd mysql -s /sbin/nologin -M 三、解压m...
    99+
    2024-04-02
  • MySQL 8.0.13 二进制安装
    MySQL 8.0 二进制安装大致与MySQL 5.7 类似 1.查询删除原有mysql使用rpm -qa | grep mysql 或mariadb 搜索 mysql,如果存在,使用rpm -e --no...
    99+
    2024-04-02
  • MySQL 5.7 二进制安装
    MySQL 在Linux 下的安装方式有 yum 、二进制 、源码安装,yum安装比较简单,这里不再介绍, 二进制版本要求不高,适用于测试用,若是线上环境,还请使用源码安装。这里主要介绍二进制安装。...
    99+
    2024-04-02
  • mysql-5.6.35二进制安装
    chown -R    mysql:mysql     /mysql/mysql/scripts/mysql_install_db&nb...
    99+
    2024-04-02
  • mysql-5.7二进制安装
    1.解压安装包: tar -zxvf mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz 创建mysql目录: mkdir -p /data/mysql cd /data/...
    99+
    2024-04-02
  • Mysql二进制包安装
    安装环境 OS:RHEL 6.5_X64 Mysql:mysql-5.7.16-linux-glibc2.5-x86_64.tar.gz 1、确认是否已经安装了依赖包 [root@dbrac16 ~]# ...
    99+
    2024-04-02
  • 如何安装使用mysql 5.7.18 zip版
    这篇文章主要为大家展示了“如何安装使用mysql 5.7.18 zip版”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“如何安装使用mysql 5.7.18 zi...
    99+
    2024-04-02
  • 如何使用二进制包来安装MySQL
    这篇文章主要介绍“如何使用二进制包来安装MySQL”,在日常操作中,相信很多人在如何使用二进制包来安装MySQL问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”如何使用二进制包...
    99+
    2024-04-02
  • mysql 二进制文件安装
    1.下载二进制文件并解压文件:下载地址:https://dev.mysql.com/downloads/mysql/5.7.html#downloadstar xvzf mysql-5.7.23-linux...
    99+
    2024-04-02
  • Mysql二进制安装过程
    Msyql介绍        MySQL是一个关系型数据库管理系统,由瑞典的MySQl AB公司开发,目前属于Oracle旗下公司。My...
    99+
    2024-04-02
  • MySQL 二进制怎么安装
    这篇文章主要为大家展示了“MySQL 二进制怎么安装”,内容简而易懂,条理清晰,希望能够帮助大家解决疑惑,下面让小编带领大家一起研究并学习一下“MySQL 二进制怎么安装”这篇文章吧。 ...
    99+
    2024-04-02
  • mysql 数据库的安装之 二 二进制安装
    #二进制安装mysql,直接解压初始化数据库就可以了1.创建用户和组[root@Lnmp tools]#useradd mysql -s /sbin/nologin/ -M2.解压安装包[root@Lnmp...
    99+
    2024-04-02
  • mysql 5.7.18绿色版如何安装配置
    这篇文章主要介绍mysql 5.7.18绿色版如何安装配置,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!1、先下载mysq5.7.18绿色版,然后解压出来,放在一个目录下,我的解压m...
    99+
    2024-04-02
  • MySQL 5.7.15 安装 (二进制版本)
    0.创建mysql用户和组信息[root@gxoradb1 ~]# groupadd mysql [root@gxoradb1 ~]# useradd -r -g mysql -s /bin/false m...
    99+
    2024-04-02
  • Mysql 5.6版本二进制安装
    时间:2018.7.30作者:李强参考:man,info,magedu讲义,万能的internet实验环境:VMware® Workstation 12 Pro ,Centos 6.9,Centos 7.4...
    99+
    2024-04-02
  • CentOS7下二进制安装mysql 5.7.23
    网上这方面的安装资料参差不齐,到处是坑,废了我好大的劲才装好,然后把自己整理一下,把安装过程记录了下来,同时也分享给有需要的朋友,话不多说,直接上菜 1、首先去Mysql官网下载Mysql5.7.23 下载...
    99+
    2024-04-02
  • Percona MySQL 5.7 Linux如何通用二进制包安装
    小编给大家分享一下Percona MySQL 5.7 Linux如何通用二进制包安装,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作