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

MySQL slow query pt-query-digest analysis of slow query log

1. Introduction pt-query-digest is a tool for ana...

Detailed tutorial on installing mysql-8.0.20 under Linux

** Install mysql-8.0.20 under Linux ** Environmen...

Steps to transfer files and folders between two Linux servers

Today I was dealing with the issue of migrating a...

Docker builds CMS on-demand system with player function

Table of contents text 1. Prepare the machine 2. ...

Detailed explanation of two points to note in vue3: setup

Table of contents In vue2 In vue3 Notes on setup ...

Angular environment construction and simple experience summary

Introduction to Angular Angular is an open source...

MySQL Basics in 1 Hour

Table of contents Getting Started with MySQL MySQ...

Steps to split and compress CSS with webpack and import it with link

Let's take a look at the code file structure ...

An article tells you how to write a Vue plugin

Table of contents What is a plugin Writing plugin...

Chinese and English font name comparison table (including Founder and Arphic)

In CSS files, we often see some font names become...

Pure CSS to modify the browser scrollbar style example

Use CSS to modify the browser scroll bar style ::...

Where is the project location deployed by IntelliJ IDEA using Tomcat?

After IntelliJ IDEA deploys a Javaweb project usi...

Detailed explanation of Vue-Jest automated testing basic configuration

Table of contents Install Configuration Common Mi...