RHEL7.5 mysql 8.0.11 installation tutorial

RHEL7.5 mysql 8.0.11 installation tutorial

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

First, go to the MySQL official website to download mysql-8.0.11-el7-x86_64.tar and unzip it.
Since mysql user is needed for mysql initialization and startup, create a mysql user:

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

After testing, it was found that the mysql related to mariadb installed in the system would report an error when starting, so the mariadb-related packages were uninstalled.

[root@rhel mysql]# yum remove mariadb*
Loaded plugins: axelget, fastestmirror, langpacks, product-id, search-disabled-
  : repos, subscription-manager
This 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 1:5.5.56-2.el7 will be erased
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-6.el7.x86_64
--> Running transaction check
---> Package postfix.x86_64 2:2.10.1-6.el7 will be erased
--> Finished Dependency Resolution
epel/x86_64/group_gz | 266 kB 00:00 

Dependencies Resolved

================================================================================
 Package Arch Version Repository Size
================================================================================
Removing:
 mariadb-libs x86_64 1:5.5.56-2.el7@base 4.4M
Removing for dependencies:
 postfix x86_64 2:2.10.1-6.el7@base 12M

Transaction Summary
================================================================================
Remove 1 Package (+1 Dependent package)

Installed size: 17M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
 Erasing : 2:postfix-2.10.1-6.el7.x86_64 1/2 
 Erasing : 1:mariadb-libs-5.5.56-2.el7.x86_64 2/2 
No metadata available for base
No metadata available for code
No metadata available for epel
No metadata available for extras
No metadata available for updates
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: mirrors.ustc.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
epel/x86_64/primary_db | 6.3 MB 00:01 
 Verifying : 1:mariadb-libs-5.5.56-2.el7.x86_64 1/2 
 Verifying : 2:postfix-2.10.1-6.el7.x86_64 2/2 

Removed:
 mariadb-libs.x86_64 1:5.5.56-2.el7      

Dependency Removed:
 postfix.x86_64 2:2.10.1-6.el7       

Complete!


Use the following command to initialize the database, which will use /var/lib/mysql as the directory for the data file:

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

So we can specify the corresponding file directory during initialization:

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

During initialization, a temporary password will be generated. Remember this password. You will need this password when you log in to MySQL. Change the password again after logging in.

Start the mysql instance:

bin/mysqld --user=mysql
bin/mysqld_safe basedir=/home/mysql --datadir=/home/mysql/data --user=mysql

If you do not add –user=mysql, the following prompt will appear:

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

This causes the MySQL instance to fail to start normally.

After MySQL is started, log in as the root user and use the randomly generated password. After logging in, change the root user's password with the following command before performing other operations:

set password = 'root';

The RHEL7 service systemctl script is stored in: /usr/lib/systemd/, which is divided into system (system) and user (user). For example, programs that need to be run without logging in should still be stored in the system service, that is, in the /usr/lib/systemd/system directory.

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

cat /usr/lib/systemd/system/mysql.service
[Unit]
Description=mysql Server
After=Network.target
After=syslog.target

[Install]
WantedBy=multi-user.target

[Service]
User=mysql
Group=mysql

Type=forking
# Execute pre and post scripts as root
PermissionsStartOnly=true
# Start main service
ExecStart=/home/mysql/bin/mysqld --daemonize
ExecStop=kill -s -QUIT $MAINPID
Restart=on-failure
RestartPreventExitStatus=1
PrivateTmp=false

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

Wonderful topic sharing:

MySQL different versions installation tutorial

MySQL 5.7 installation tutorials for various versions

MySQL 5.6 installation tutorials for various versions

mysql8.0 installation tutorials for various versions

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed installation steps for MySQL 8.0.11
  • MySQL 8.0.11 installation and configuration method graphic tutorial
  • MySQL 8.0.11 MacOS 10.13 installation and configuration method graphic tutorial
  • MySQL 8.0.11 winx64 installation and configuration method graphic tutorial
  • MySQL 8.0.12 installation and configuration method graphic tutorial
  • MySQL 8.0.12 installation and configuration graphic tutorial
  • MySQL 8.0.12 decompression version installation tutorial
  • mysql installer community 8.0.12.0 installation graphic tutorial
  • MySQL 8.0.12 installation configuration method and password change
  • MySQL 8.0.11 MSI version installation and configuration graphic tutorial

<<:  JavaScript to implement simple tab bar switching content bar

>>:  Nginx reverse proxy forwards port 80 requests to 8080

Recommend

HTML table cross-row and cross-column operations (rowspan, colspan)

Generally, the colspan attribute of the <td>...

HTML table markup tutorial (43): VALIGN attribute of the table header

In the vertical direction, you can set the alignm...

Vue uses element-ui to implement menu navigation

This article shares the specific code of Vue usin...

Detailed explanation of Mysql's concurrent parameter adjustment

Table of contents Query cache optimization Overvi...

How to handle long data when displaying it in html

When displaying long data in HTML, you can cut off...

javascript realizes 10-second countdown for payment

This article shares the specific code of javascri...

Solve the problem of inconsistent MySQL storage time

After obtaining the system time using Java and st...

How to install mysql in docker

I recently deployed Django and didn't want to...

Reasons and solutions for MySQL failing to create foreign keys

When associating two tables, a foreign key could ...

Installing Windows Server 2008 operating system on a virtual machine

This article introduces the installation of Windo...