Nous avons résumé les étapes d'installation de MySQL Community Server sur Oracle Linux et CentOS, qui sont fournies sous forme d'images standard ORACLE par Oracle Cloud Infrastructure (OCI) Compute Service. Je l'ai confirmé avec une combinaison d'Oracle Linux 8/7 (CentOS 7) et de MySQL Community Server 8.0 / 5.7.
Avant d'expliquer la procédure détaillée, j'ai résumé les commandes d'installation pour chaque combinaison. Les commandes telles que la vérification du référentiel sont omises.
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
Nous vérifierons la procédure détaillée basée sur le journal d'exécution lorsque MySQL 8.0 sera installé sur Oracle Linux 8.2. J'ai utilisé la commande dnf (yum) qui apparaissait dans RHEL 8.0 [^ 1]. Nous vérifierons à partir de la version OS de l'image fournie par ORACLE de la machine virtuelle créée par OCI Compute Service.
[^ 1]: Notes de publication d'Oracle® Linux 8 pour Oracle Linux 8 Annexe A Comparaison de Yum version 3 avec DNF -yum-appendix.html)
python
$ cat /etc/oracle-release
Oracle Linux Server release 8.2
Ensuite, installez le fichier RPM MySQL 8.0 pour Oracle Linux 8. Le référentiel de Yum est ci-dessous. MySQL Community Downloads - MySQL Yum Repository
python
$ sudo rpm -Uvh http://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
Vérifiez les référentiels activés.
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
Désactivez les modules MySQL et MarinaDB définis par défaut.
python
$ sudo dnf module disable mysql mariadb
Vérifiez la version du package à installer avec la commande suivante.
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.
S'il n'y a pas de problème, installez-le avec la commande suivante.
python
$ sudo dnf install mysql-community-server
Une fois l'installation terminée, vérifiez la version de MySQL avec la commande suivante.
python
$ mysqld --version
/usr/sbin/mysqld Ver 8.0.22 for Linux on x86_64 (MySQL Community Server - GPL)
Commençons 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.
Le mot de passe initial de l'utilisateur root est enregistré dans / var / log / mysqld.log
lorsque MySQL est démarré pour la première fois. Accédez au fichier et recherchez l'emplacement du mot de passe.
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
Exécutez mysql_secure_installation
pour effectuer les paramètres initiaux liés à la sécurité tels que la réinitialisation du mot de passe. Je vérifie les paramètres de mysql_secure_installation
étape par étape.
Tout d'abord, lorsque vous démarrez mysql_secure_installation
, il vous sera demandé le mot de passe initial de l'utilisateur root, alors entrez-le et démarrez-le. Utilisez le mot de passe confirmé dans / var / log / mysqld.log
. En outre, il est dit que le mot de passe root a expiré, alors définissez un nouveau mot de passe. Vous devez le saisir deux fois pour 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
Il vous sera également demandé si vous souhaitez modifier le mot de passe de l'utilisateur root. Encore une fois, vous devez le saisir deux fois pour 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
Il vous sera demandé si vous souhaitez supprimer l'utilisateur anonyme, entrez «y» pour supprimer l'utilisateur anonyme.
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.
Il vous sera demandé si vous souhaitez bloquer l'accès des utilisateurs root à distance, alors entrez y
pour bloquer l'accès à distance.
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.
Il vous sera demandé si vous souhaitez supprimer la base de données de test, alors entrez «y» pour la supprimer.
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.
Enfin, il vous sera demandé si vous souhaitez mettre à jour le changement d'autorisation, alors entrez y
pour mettre à jour
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!
Assurez-vous qu'il est accessible depuis le client MySQL.
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 Manuel de référence de MySQL 5.6 2.5 Installer MySQL sur Linux