--How to use Oracle MySQL Database Service Memo-Extra edition --I had a hard time with the combination of Oracle Linux 8/7 (CentOS7) and MySQL Community Server 8.0 / 5.7, so a memorandum
We have summarized the steps to install MySQL Community Server on Oracle Linux and CentOS, which are provided as ORACLE standard images by Oracle Cloud Infrastructure (OCI) Compute Service. Confirmed with a combination of Oracle Linux 8/7 (CentOS 7) and MySQL Community Server 8.0 / 5.7.
The installation commands for each combination are summarized before the detailed procedure is explained. Commands such as checking the repository are omitted.
Oracle Linux 8.2
Oracle Linux Server release 8.2 MySQL Ver 8.0.22 MySQL Ver 5.7.32
python
$ sudo rpm -Uvh http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
$ sudo dnf module disable mysql mariadb
$ sudo dnf install mysql-community-server
$ sudo systemctl start mysqld
$ sudo cat /var/log/mysqld.log | grep password
$ mysql_secure_installation
python
$ sudo rpm -Uvh https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-release-el7-7.noarch.rpm
$ sudo dnf config-manager --disable mysql56-community
$ sudo dnf config-manager --enable mysql57-community
$ sudo dnf module disable mysql mariadb
$ sudo dnf install mysql-community-server
$ sudo systemctl start mysqld
$ sudo cat /var/log/mysqld.log | grep password
$ mysql_secure_installation
Oracle Linux 7.9 / CentOS Linux 7.8
Oracle Linux Server release 7.9 CentOS Linux release 7.8 MySQL Ver 8.0.22 MySQL Ver 5.7.32
python
$ sudo rpm -Uvh http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
$ sudo yum install mysql-community-server
$ sudo systemctl start mysqld
$ sudo cat /var/log/mysqld.log | grep password
$ mysql_secure_installation
python
$ sudo rpm -Uvh https://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-release-el7-7.noarch.rpm
$ sudo yum-config-manager --disable mysql56-community
$ sudo yum-config-manager --enable mysql57-community
$ sudo yum install mysql-community-server
$ sudo systemctl start mysqld
$ sudo cat /var/log/mysqld.log | grep password
$ mysql_secure_installation
We will check the detailed procedure based on the execution log when MySQL 8.0 is installed on Oracle Linux 8.2. I used the dnf (yum) command that appeared in RHEL 8.0 [^ 1]. Check from the OS version of the image provided by ORACLE of the virtual machine created by OCI Compute Service.
[^ 1]: Oracle® Linux 8 Release Notes for Oracle Linux 8 Appendix A Comparison of Yum Version 3 with DNF -yum-appendix.html)
python
$ cat /etc/oracle-release
Oracle Linux Server release 8.2
Next, install the MySQL 8.0 RPM file for Oracle Linux 8. The Yum repository is below. MySQL Community Downloads - MySQL Yum Repository
python
$ sudo rpm -Uvh http://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
Check the repositories that are enabled.
python
$ sudo dnf repolist all
Failed to set locale, defaulting to C.UTF-8
repo id repo name status
ksplice-uptrack Ksplice Uptrack for Oracle Linux disabled
mysql-cluster-8.0-community MySQL Cluster 8.0 Community disabled
mysql-cluster-8.0-community-source MySQL Cluster 8.0 Community - Source disabled
mysql-connectors-community MySQL Connectors Community enabled
mysql-connectors-community-source MySQL Connectors Community - Source disabled
mysql-tools-community MySQL Tools Community enabled
mysql-tools-community-source MySQL Tools Community - Source disabled
mysql-tools-preview MySQL Tools Preview disabled
mysql-tools-preview-source MySQL Tools Preview - Source disabled
mysql80-community MySQL 8.0 Community Server enabled
mysql80-community-source MySQL 8.0 Community Server - Source disabled
ol8_UEKR6 Latest Unbreakable Enterprise Kernel Release enabled
ol8_UEKR6_RDMA Oracle Linux 8 UEK6 RDMA (x86_64) disabled
ol8_addons Oracle Linux 8 Addons (x86_64) enabled
ol8_appstream Oracle Linux 8 Application Stream (x86_64) enabled
ol8_baseos_latest Oracle Linux 8 BaseOS Latest (x86_64) enabled
ol8_codeready_builder Oracle Linux 8 CodeReady Builder (x86_64) - U disabled
ol8_developer Oracle Linux 8 Development Packages (x86_64) disabled
ol8_developer_EPEL Oracle Linux 8 EPEL Packages for Development disabled
ol8_developer_UEKR6 Developer Preview of UEK Release 6 (x86_64) disabled
ol8_ksplice Ksplice for Oracle Linux 8 (x86_64) enabled
ol8_oci Oracle Linux 8 OCI Packages (x86_64) enabled
ol8_oci_included Oracle Software for OCI users on Oracle Linux enabled
ol8_u0_baseos_base Oracle Linux 8 BaseOS GA (x86_64) disabled
ol8_u1_baseos_base Oracle Linux 8.1 BaseOS (x86_64) disabled
ol8_u2_baseos_base Oracle Linux 8.2 BaseOS (x86_64) disabled
Disable the MySQL and MarinaDB modules that are set by default.
python
$ sudo dnf module disable mysql mariadb
Check the version of the package to be installed with the following command.
python
$ sudo dnf info mysql-community-server
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:01:02 ago on Sun Nov 15 11:00:21 2020.
Available Packages
Name : mysql-community-server
Version : 8.0.22
Release : 1.el8
Architecture : x86_64
Size : 53 M
Source : mysql-community-8.0.22-1.el8.src.rpm
Repository : mysql80-community
Summary : A very fast and reliable SQL database server
URL : http://www.mysql.com/
License : Copyright (c) 2000, 2020, Oracle and/or its affiliates. Under GPLv2
: license as shown in the Description field.
Description : The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
: and robust SQL (Structured Query Language) database server. MySQL Server
: is intended for mission-critical, heavy-load production systems as well
: as for embedding into mass-deployed software. MySQL is a trademark of
: Oracle and/or its affiliates
:
: The MySQL software has Dual Licensing, which means you can use the MySQL
: software free of charge under the GNU General Public License
: (http://www.gnu.org/licenses/). You can also purchase commercial MySQL
: licenses from Oracle and/or its affiliates if you do not wish to be bound
: by the terms of the GPL. See the chapter "Licensing and Support" in the
: manual for further info.
:
: The MySQL web site (http://www.mysql.com/) provides the latest news and
: information about the MySQL software. Also please see the documentation
: and the manual for more information.
:
: This package includes the MySQL server binary as well as related utilities
: to run and administer a MySQL server.
If there is no problem, install it with the following command.
python
$ sudo dnf install mysql-community-server
After the installation is complete, check the MySQL version with the following command.
python
$ mysqld --version
/usr/sbin/mysqld Ver 8.0.22 for Linux on x86_64 (MySQL Community Server - GPL)
Let's start MySQL.
python
$ sudo systemctl start mysqld
$ sudo systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disab>
Active: active (running) since Sun 2020-11-15 11:03:45 GMT; 9s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 37102 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 37178 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 48672)
Memory: 458.6M
CGroup: /system.slice/mysqld.service
└─37178 /usr/sbin/mysqld
Nov 15 11:03:36 iaasmysql systemd[1]: Starting MySQL Server...
Nov 15 11:03:45 iaasmysql systemd[1]: Started MySQL Server.
The initial password of the root user is recorded in /var/log/mysqld.log
when MySQL is started for the first time. Access the file and search for the password description.
python
$ sudo cat /var/log/mysqld.log | grep password
2020-11-15T11:03:41.974831Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: PASSWORD
Run mysql_secure_installation
to perform security-related initial settings such as resetting passwords. I am checking the settings of mysql_secure_installation
in Step-by-Step.
First, when you start mysql_secure_installation
, you will be asked for the initial password of the root user, so enter it and start it. Use the password confirmed in /var/log/mysqld.log
. Also, it is said that the root password has expired, so set a new password. You need to enter it twice for confirmation.
python
$ mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
The existing password for the user account root has expired. Please set a new password.
New password:
Re-enter new password:
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.
Estimated strength of the password: 100
You will also be asked if you want to change the root user password. Again, you need to enter it twice for confirmation.
python
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
New password:
Re-enter new password:
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
You will be asked if you want to delete the anonymous user, so enter y
to delete the anonymous user.
python
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.
You will be asked if you want to prevent remote root user access, so enter y
to prevent remote access.
python
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.
You will be asked if you want to delete the test database, so enter y
to delete it.
python
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.
Finally, you will be asked if you want to update the permission change, so enter y
to update
python
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!
Make sure it is accessible from the MySQL client.
python
$ mysql -u root mysql -p
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 8.0.22 MySQL Community Server - GPL
Copyright (c) 2000, 2020, 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>
MySQL 8.0 Reference Manual 2.5 Installing MySQL on Linux MySQL 5.6 Reference Manual 2.5 Install MySQL on Linux
Recommended Posts