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

Installation tutorial of mysql 8.0.11 under RHEL7.5

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article records the installation tutorial of mysql 8.0.11 under RHEL7.5, the specific contents are as follows

First of all, go to the mysql official website to download mysql-8.0.11-el7-x86_64.tar decompression.

Since the mysql user is required for mysql initialization and startup, create a mysql user:

Useradd-d / home/mysql-m-s / bin/bash mysql

After testing, it is found that the mariadb-related mysql in the system will report an error when starting, so uninstall the mariadb-related package.

[root@rhel mysql] # yum remove mariadb*Loaded plugins: axelget, fastestmirror, langpacks, product-id, search-disabled-: repos, subscription-managerThis system is not registered with an entitlement server. You can use subscription-manager to register.Resolving Dependencies-- > Running transaction check--- > Package mariadb-libs.x86_64 1vig 5.5.56-2.el7 will be erased-- > Processing Dependency: libmysqlclient.so.18 () (64bit) for package: 2:postfix-2.10.1-6.el7.x86q64murf-> Processing Dependency: libmysqlclient.so.18 (libmysqlclient_18) (64bit) for package: 2:postfix-2.10.1-6.el7.x86y64murf- > Running transaction check--- > Package postfix.x86_64 2kB 2.10.1-6.el7 will be erased-- > Finished Dependency Resolutionepel/x86_64/group_gz | 266 kB 00:00 Dependencies Resolved==== Package Arch Version Repository Size====Removing: mariadb-libs x86 Dependent package 64 1V 5.5.56-2.el7 @ base 4.4 MRemoving for dependencies: postfix x86 V 64 2V 2.10.1-6.el7 @ base 12 MTransaction Summary====Remove 1 Package (+ 1 Dependent package) Installed size: 17 MIs this ok [base N]: yDownloading packages:Running transaction checkRunning transaction testTransaction test succeededRunning transaction Erasing: 2:postfix-2.10.1-6.el7.x86_64 1 Erasing: 1:mariadb-libs-5.5.56-2.el7.x86_64 2 No metadata available for baseNo metadata available for codeNo metadata available for epelNo metadata available for extrasNo metadata available for updatesLoading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.ustc.edu.cn * extras: mirrors.aliyun.com * updates: Mirrors.aliyun.comepel/x86_64/primary_db | 6. 3 MB 00:01 Verifying: 1:mariadb-libs-5.5.56-2.el7.x86_64 1 Verifying 2 Verifying: 2:postfix-2.10.1-6.el7.x86_64 2 6.el7.x86_64 2 Removed: mariadb-libs.x86_64 1 Verifying 5.5.56-2.el7 Dependency Removed: postfix.x86_64 2 1:mariadb-libs-5.5.56 2 postfix.x86_64-6.el7 Complete!

Initialize the database with the following command in the directory where / var/lib/mysql is the data file:

Shell > bin/mysqld-- initialize-- user=mysql

So we can specify the corresponding file directory at initialization time:

Bin/mysqld-initialize-basedir=/home/mysql-datadir=/home/mysql/data-user=mysql

During initialization, a temporary password will be generated, remember the password, and need to be used when logging in to mysql, and then change the password again.

Start the mysql instance:

Bin/mysqld-user=mysqlbin/mysqld_safe basedir=/home/mysql-datadir=/home/mysql/data-user=mysql

If you do not add-user=mysql, the following prompt appears:

2018-04-22T15:47:25.471462Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as rootstocks 2018-04-22T15:47:25.471514Z 0 [ERROR] [MY-010119] [Server] Aborting

Causes the mysql instance to fail to start normally.

After mysql starts, log in with the root user, use the password you just randomly generated, and then change the password of the root user with the following command, and then do other operations:

Set password = 'root'

RHEL7's service systemctl scripts are stored in: / usr/lib/systemd/, can be divided into system (system) and user (user). For example, programs that can be run without logging in are stored in the system service, that is, / usr/lib/systemd/system directory.

Each service ends with .service and is generally divided into three parts: [Unit], [Service] and [Install]. Now add MYSQL as follows:

Cat / usr/lib/systemd/system/ mysql.service[ Unit] Description=mysql ServerAfter=Network.targetAfter= syslog.target [install] WantedBy=multi-user.target [Service] User=mysqlGroup=mysqlType=forking# Execute pre and post scripts as rootPermissionsStartOnly=true# Start main serviceExecStart=/home/mysql/bin/mysqld-- daemonizeExecStop=kill-s-QUIT $MAINPIDRestart=on-failureRestartPreventExitStatus=1PrivateTmp=false

You can use systemctl to start, restart, and shut down the mysql service.

Wonderful topic sharing:

Installation tutorials for different versions of mysql

Installation tutorials for each version of mysql5.7

Installation tutorials for each version of mysql5.6

Installation tutorials for each version of mysql8.0

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

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