In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how RHEL 7.2 installs binary MySQL 5.7.18. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Environment:
Red Hat Enterprise Linux Server release 7.2 (Maipo)
Mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz
Installation requirements:
Libaio
MySQL 5.7.19 and later needs to install libnuma, because this test is 5.7.18, it is not necessary to install libnuma.
If you have installed MySQL before, clear the directory and files
/ etc/my.cnf or the / etc/mysql
Rhel7 needs to cancel the RemoveIPC restriction in the future.
[root@rhelb mysql] # vi / etc/systemd/logind.conf
# RemoveIPC=yes-> RemoveIPC=no
Check whether the package is installed
[root@rhelb mysql] # rpm-qa | grep libaio
Turn off the firewall
[root@rhelb yum.repos.d] # vi / etc/sysconfig/selinux
SELINUX=enforcing- > SELINUX=disabled
There is a change in closing the THP file after and before closing the system THP,rhel7. The rhel7 and later closing methods are as follows:
[root@rhelb yum.repos.d] # cat / sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
Add transparent_hugepage=never after quiet
[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"
Restart the host after adding
[root@rhelb yum.repos.d] # cat / sys/kernel/mm/transparent_hugepage/enabled
Always madvise [never]
After configuring the yum source, create a new yum database after rhel7
[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
Install the package:
[root@rhelb mysql] # yum-y install libaio.x86_64
.
Installed:
Libaio.x86_64 0RO 0.3.109-13.el7
Complete!
MySQL binary directory description:
DirectoryContents of Directorybinmysqld server, client and utility programsdocsMySQL manual in Info formatmanUnix manual pagesincludeInclude (header) fileslibLibrariesshareError messages, dictionary, and SQL for database installationsupport-filesMiscellaneous support files
Decompression software:
[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
Create related users:
[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/
Initialize the database:
View the mysqld parameters:
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 x86x64 (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 initialization password 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
Configure ssl for session security considerations. You don't have to configure it if you don't need it.
[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'
Configuration parameter file, prompt / tmp/socket.sock if you do not configure [client] client connection
[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 removes security risks:
A) set the password for root users
B) Delete anonymous accounts
C) cancel remote login for root users
D) remove the test library and access to the test library
E) refresh the authorization table to make the changes effective
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: = 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!
Configuration service startup:
[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 10 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
Thank you for reading! This is the end of this article on "how to install binary MySQL 5.7.18 in RHEL 7.2". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.