Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

KVM MYSQL 5.7What is the method of installing documentation for stand-alone FOR OEL7.5

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what is the method of KVM MYSQL 5.7stand-alone FOR OEL7.5 installation document". In daily operation, I believe many people have doubts about the method of KVM MYSQL 5.7stand-alone FOR OEL7.5 installation documentation. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the question of "what is the method of installing KVM MYSQL 5.7stand-alone FOR OEL7.5 documentation"! Next, please follow the editor to study!

1. KVM MYSQL 5.7standalone FOR OEL7.5 usually installs document 2. Installation process 2.1. Determine the platform version and number of machine bits.

Determine whether the current MYSQL version is supported by various operating system platforms.

2.2. Download the corresponding version 2.2.1. Download the binary installation package

 official website

 http://dev.mysql.com/downloads/mirrors.html.

After entering , you can choose the corresponding version.

NOTE:

Tar.gz tar.xz is a binary installation.

RPM installs the package for rpm.

Deb installs the package for deband linux.

PKG installs the package for the mac file.

2.2.2. Download the yum Source configuration package (Community Edition)

Https://dev.mysql.com/downloads/repo/yum/

2.2.3. Download source code compilation

The  source code is currently hosted on GIT.

2.3. Verify that the downloaded file is correct

LINUX AND WINDOWS MD5 verification

Shell > md5sum mysql-standard-8.0.13-linux-i686.tar.gzaaab65abbec64d5e907dcd41b8699945 mysql-standard-8.0.13-linux-i686.tar.gzshell > md5.exe mysql-installer-community-8.0.13.msiaaab65abbec64d5e907dcd41b8699945 mysql-installer-community-8.0.13.msi

RPM package verification

Shell > rpm-checksig MySQL-server-8.0.13-0.linux_glibc2.5.i386.rpmMySQL-server-8.0.13-0.linux_glibc2.5.i386.rpm: md5 gpg OK3. Binary deployment

NOTE:

Using binary installation is different from yum installation to automatically analyze related dependency packages. You must first remove mariadb or previously installed mysql configuration files. For example, / etc/my.conf.

Uninstall mariadb

Shell > yum remove mariadb*

Install dependency packages

Shell > yum search libaio # search for infoshell > yum install libaio # install library3.1. Installation directory description 3.2. Install MySQL3.2.1. Create MySQL users and groups shell > groupadd mysqlshell > useradd-r-g mysql-s / bin/false mysql3.2.2. Decompression software shell > cd / usr/localshell > tar zxvf / path/to/mysql-VERSION-OS.tar.gzshell > gunzip

< /path/to/mysql-VERSION-OS.tar.gz | tar xvf -3.2.3. 创建新的链接文件到真实目录shell>

Ln-s full-path-to-mysql-VERSION-OS mysql3.2.4. Set the environment variable shell > export PATH=$PATH:/usr/local/mysql/bin3.2.5. Configure the startup directory shell > cd mysqlshell > mkdir mysql-filesshell > chown mysql:mysql mysql-filesshell > chmod 750 mysql-files3.2.6. Initialize the database shell > bin/mysqld-- initialize-- user=mysql3.2.6.1. There are two ways to initialize the database: shell > bin/mysqld-- initialize--user=mysqlshell > bin/mysqld-- initialize-insecure-- user=mysql

NOTE:

There are two initialization methods. The first one must be forced to log in with a password.

The second way is to skip the password.

Shell > mysql-u root-- skip-password

Then change the corresponding password

Mysql > ALTER USER 'root'@'localhost' IDENTIFIED BY' new_password'

The password encrypted by default in mysql 8.0 has been changed. Caching_sha2_password encryption is now used by default.

Use the default mode if you also need to use the default mysql_native_password encryption.

When initializing, the default path is / usr/local/mysql

3.2.6.2. Change the default path

If you want to change the installation directory, use the following directory:

Shell > bin/mysqld-initialize-user=mysql-basedir=/opt/mysql/mysql-datadir=/opt/mysql/mysql/data

Configuration file

[mysqld] basedir=/opt/mysql/mysqldatadir=/opt/mysql/mysql/data

Use the configuration file to specify the location:

Example

Shell > bin/mysqld-initialize-insecure-user=mysql\-basedir=/app/mysql\-datadir=/app/mysql/mysql-files

Output log:

[root@mysql1 mysql] # bin/mysqld-- initialize-insecure-- user=mysql\ >-- basedir=/app/mysql\ >-- datadir=/app/mysql/mysql-files2018-09-28T16:18:32.178288Z 0 [System] [MY-013169] [Server] / app/mysql-commercial-8.0.12-el7-x86_64/bin/mysqld (mysqld 8.0.12-commercial) initializing of server in progress as process 53282018-09-28T16:18:46.268910Z 5 [Warning] [MY-010453] [Server] root@localhost is created with an empty password! Please consider switching off the-- initialize-insecure option.2018-09-28T16:18:57.082553Z 0 [System] [MY-013170] [Server] / app/mysql-commercial-8.0.12-el7-x86_64/bin/mysqld (mysqld 8.0.12-commercial) initializing of server has completed3.2.7. Create a secure connection 3.2.7.1. It shows that FormatDescription-datadirPath to data directory-helpDisplay help message and exit-suffixSuffix for X509 certificate Common Name attribute-uidName of effective user to use for file permissions-verboseVerbose mode-versionDisplay version information and exit3.2.7.2. The default directory is shell > bin/mysql_ssl_rsa_setup3.2.7.3. Specify the directory bin/mysql_ssl_rsa_setup-- datadir=/app/mysql/mysql-files/

-at this point, the installation is complete-

4. YUM source installation

a. To download MySQL's repo file: http://dev.mysql.com/downloads/repo/yum/

Wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

b. Select the corresponding operating system version of the

c. Local installation

Shell > sudo yum localinstall platform-and-version-specific-package-name.rpm

EL6-based system

Shell > sudo yum localinstall mysql80013-community-release-el6- {version-number} .noarch.rpm

EL7-based system:

Shell > sudo yum localinstall mysql80013-community-release-el7- {version-number} .noarch.rpm

Fedora 28:

Shell > sudo dnf localinstall mysql80013-community-release-fc28- {version-number} .noarch.rpm

Fedora 27:

Shell > sudo dnf localinstall mysql80013-community-release-fc27- {version-number} .noarch.rpm

Example:

Yum localinstall mysql80-community-release-el7-1.noarch.rpm

Check that the MySQL feed is enabled

Yum repolist enabled | grep "mysql.*-community.*"

Enable cluster installation

Mysql-cluster

View all mysql-related installation sources

Shell > yum repolist all | grep mysql

Open the corresponding installation yum source

Shell > sudo yum-config-manager-- disable mysql57-communityshell > sudo yum-config-manager-- enable mysql80-community

For example:

Open the cluster

Shell > sudo yum-config-manager-- enable mysql-cluster-7.6-community

Install MYSQL

Yum install mysql-community-server5. Install using the RPM package

Description:

Because the Enterprise Edition only provides binary and RPM packages. YUM installation is not provided.

The following is the meaning of each RPM package:

Package NameSummarymysql-commercial-backupMySQL Enterprise Backup (added in 8.0.11) mysql-commercial-clientMySQL client applications and toolsmysql-commercial-commonCommon files for server and client librariesmysql-commercial-develDevelopment header files and libraries for MySQL database client applicationsmysql-commercial-embedded-compatMySQL server as an embedded library with compatibility for applications using version 18 of the librarymysql-commercial-libsShared libraries for MySQL database client applicationsmysql-commercial-libs-compatShared compatibility libraries for previous MySQL installations; the version of the libraries matches the version of the libraries installed by default by the distribution you are usingmysql-commercial-minimal-debuginfoDebug information for package mysql-commercial-server-minimal Useful when developing applications that use this package or when debugging this packagemysql-commercial-serverDatabase server and related toolsmysql-commercial-server-minimalMinimal installation of the database server and related tools (added in 8.0.0) mysql-commercial-testTest suite for the MySQL server

Download the corresponding version of RPM package for decompression

[root@mysql3] # unzip V979091-01.zip Archive: V979091-01.zipextracting: mysql-commercial-libs-8.0.12-1.1.el7.x86_64.rpm extracting: mysql-commercial-embedded-compat-8.0.12-1.1.el7.x86_64.rpm extracting: mysql-commercial-test-8.0.12-1.1.el7.x86_64.rpm extracting: mysql-commercial-server-8.0.12-1.1.el7.x86_64 Rpm extracting: mysql-commercial-server-minimal-8.0.12-1.1.el7.x86_64.rpm extracting: mysql-commercial-minimal-debuginfo-8.0.12-1.1.el7.x86_64.rpm extracting: mysql-commercial-devel-8.0.12-1.1.el7.x86_64.rpm extracting: mysql-commercial-client-8.0.12-1.1.el7.x86_64.rpm extracting: mysql-commercial-libs-compat-8.0. 12-1.1.el7.x86_64.rpm extracting: mysql-commercial-common-8.0.12-1.1.el7.x86_64.rpm extracting: mysql-commercial-backup-8.0.12-1.1.el7.x86_64.rpm extracting: README.txt

Batch automatic installation: automatically resolve dependency packages. Be careful not to mix with server_mini when using this command.

Yum install mysql-commercial-*

Simple server

Sudo yum install mysql-community- {server,client,common,libs}-*

Simple client

Yum install mysql-community- {client,common,libs}-*

Catalogue distribution

Files or ResourcesLocationClient programs and scripts/usr/binmysqld server/usr/sbinConfiguration file/etc/my.cnfData directory/var/lib/mysqlError log fileFor RHEL, Oracle Linux, CentOS or Fedora platforms: / var/log/mysqld.logFor SLES: / var/log/mysql/mysqld.logValue of secure_file_priv/var/lib/mysql-filesSystem V init scriptFor RHEL, Oracle Linux, CentOS or Fedora platforms: / etc/init.d/mysqldFor SLES: / etc/init.d/mysqlSystemd serviceFor RHEL, Oracle Linux CentOS or Fedora platforms: mysqldFor SLES: mysqlPid file/var/run/mysql/mysqld.pidSocket/var/lib/mysql/mysql.sockKeyring directory/var/lib/mysql-keyringUnix manual pages/usr/share/manInclude (header) files/usr/include/mysqlLibraries/usr/lib/mysqlMiscellaneous support files (for example, error messages, and character set files) / usr/share/mysql5.1. Install related components

List all related installation packages that are opened in yum. , including sources not in enable

For example, a lower-version client should be connected to the host. Then you need to install the lower version client as follows:

Rpm-oldpackage-ivh mysql-community-libs-5.5.50-2.el6.x86_64.rpm

Install other software: download the corresponding version from the official website.

6. Turn 6.1 on and off. Use binary to install shell > bin/mysqld_safe-- user=mysql & # 6. Next command is optional6.1.1. Copy the startup file shell > cp / app/mysql/support-files/mysql.server / etc/init.d/6.1.2. Edit the my.cnf file basedir=/app/mysqldatadir=/app/mysql/mysql-files6.1.3. Reload the startup project systemctl daemon-reload6.1.4. Check to see if you start MySQLsystemctl status mysql6.1.5. Boot self-start

NOTE:

Because you are using a binary installation, you need to configure chkconfig. RPM package is not required

Chkconfig-- add mysql.serverchkconfig mysql.server on6.2. Install 6.2.1 using the yum source. Start MySQLservice mysqld startsystemctl start mysqld6.2.2. Check to see if you start MySQLsystemctl status mysqld6.2.3. Boot self-boot systemctl enable mysqldsystemctl disable mysqld6.3. Install 6.3.1 using the RPM package. Start MySQLservice mysqld startsystemctl start mysqld6.3.2. Check to see if you start MySQLsystemctl status mysqld6.3.3. Boot self-boot systemctl enable mysqldsystemctl disable mysqld7. Diagnosis 7. 1 after MySQL startup. Check the log tail host_name.err7.2. Select driver

Default is InnoDB

7.3. Confirm that the location of the data file is appropriate for 7.4. View all configuration parameters and all environment variables mysqld-basedir=/app/mysql-verbose-help | more7.5. Configuration file environment variable mysqladmin variables-u root-p mysqladmin-h host_name variables-u root-p8. Test MySQL

Check whether mysql is running properly

Mysqladmin version

Check the value of the configuration variable

Mysqladmin variables

Check to see if you can log in

Mysqladmin-u root-p version

Turn off the mysql service

Mysqladmin-u root shutdown

Show mysql database

Mysqlshow

Show tables in a database

Mysqlshow mysql

Shell interface query table data

Mysql-e "SELECT User, Host, plugin FROM mysql.user" mysql

NOTE:

After the above command is executed successfully, the mysql data is normal.

9. Account security 9.1. Yum source installation

Temporary password:

Grep 'temporary password' / var/log/mysqld.log

Login:

Mysql-uroot-p

Change the password:

ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPass4passport'

Due to the requirement of password complexity: but the test is not required.

Mysql > SHOW VARIABLES LIKE 'validate_password%' +-- +-+ | Variable_name | Value | +-- +-+ | validate_password.check_ User_name | ON | | validate_password.dictionary_file | | validate_password.length | 8 | validate_password.mixed_case_count | 1 | validate_password.number_count | 1 | validate_password.policy | MEDIUM | | validate_password.special_char_count | 1 | + -+-+ 7 rows in set (0.01sec) set GLOBAL validate_password.policy=0 Set password length set GLOBAL validate_password.length=3

Set the password complexity to low. It's easier to test.

ALTER USER 'root'@'localhost' IDENTIFIED BY' 1234 investors 9.2. Binary installation

Password change after initialization using mysqld-insecure

Mysql-u root-pALTER USER 'root'@'localhost' IDENTIFIED BY' new_password'

If you use mysqld-initialize-insecure for initialization

Then:

Mysql-u root-- skip-password

Change the password:

ALTER USER 'root'@'localhost' IDENTIFIED BY' 123 # 9.3. RPM package installation

Temporary password:

Grep 'temporary password' / var/log/mysqld.log

Login:

Mysql-uroot-p

Change the password:

ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPass4passport'

Due to the requirement of password complexity: but the test is not required.

Mysql > SHOW VARIABLES LIKE 'validate_password%' +-- +-+ | Variable_name | Value | +-- +-+ | validate_password.check_ User_name | ON | | validate_password.dictionary_file | | validate_password.length | 8 | validate_password.mixed_case_count | 1 | validate_password.number_count | 1 | validate_password.policy | MEDIUM | | validate_password.special_char_count | 1 | + -+-+ 7 rows in set (0.01sec) mysql > set GLOBAL validate_password.policy=0 Mysql > set GLOBAL validate_password.length=3

Set the password complexity to low. It's easier to test.

ALTER USER 'root'@'localhost' IDENTIFIED BY' 1234 birthday 10. Appendix 10.1. Forget the root password

Method 1:

Kill `cat / mysql-data-directory/host_ name.pid`

Save the following statements to a file

ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPass'

For example: / root/mysql-init

Start changing the password.

Mysqld-- init-file=/home/me/mysql-init &

The mysql service starts automatically.

Then delete the file that saved the password.

Method 2:

Add my.cnf option

Skip-grant-tables:

Restart MySQL

Change password

Mysqlupdate user set password=password ("new_pass") where user= "root"; FLUSH PRIVILEGES;ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPass'; so far, the study on "what is the method of installing FOR OEL7.5 on a stand-alone KVM MYSQL 5.7" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report