Bii o ṣe le Fi MySQL 8.0 sori RHEL/CentOS 8/7 ati Fedora 30


MySQL jẹ orisun ṣiṣakoso orisun data ibatan ibatan ọfẹ (RDBMS) ti a tu silẹ labẹ GNU (Iwe-aṣẹ Gbogbogbo Gbogbogbo). O ti lo lati ṣiṣẹ ọpọlọpọ awọn apoti isura data lori eyikeyi olupin nikan nipa fifun iraye si ọpọlọpọ olumulo si ibi ipamọ data kọọkan ti a ṣẹda.

Nkan yii yoo rin nipasẹ ọ ni ilana ti fifi sori ẹrọ ati mimuṣeṣe tuntun MySQL 8.0 tuntun lori RHEL/CentOS 8/7/6/ati Fedora 28-30 ni lilo ibi ipamọ MySQL Yum nipasẹ ohun elo YUM.

Igbesẹ 1: Fifi ibi ipamọ MySQL Yum sii

1. A yoo lo ibi ipamọ sọfitiwia MySQL Yum ti oṣiṣẹ, eyiti yoo pese awọn idii RPM fun fifi ẹya tuntun ti olupin MySQL sori ẹrọ, alabara, Awọn ohun elo MySQL, MySQL Workbench, Asopọ/ODBC, ati Asopọ/Python fun RHEL/CentOS 8/7/6/ati Fedora 28-30.

Pataki: Awọn itọnisọna wọnyi n ṣiṣẹ lori fifi sori tuntun ti MySQL lori olupin naa, ti o ba ti wa tẹlẹ MySQL ti fi sori ẹrọ nipa lilo package RPM ti o pin kaakiri ẹni-kẹta, lẹhinna Mo ṣeduro fun ọ lati ṣe igbesoke tabi rọpo package MySQL ti o fi sii nipa lilo MySQL Ibi ipamọ Yum ”.

Ṣaaju Igbegasoke tabi Rirọpo package MySQL atijọ, maṣe gbagbe lati mu gbogbo afẹyinti data pataki ati awọn faili iṣeto ni.

2. Nisisiyi gba lati ayelujara ati ṣafikun ibi ipamọ MySQL Yum wọnyi si akojọ ibi ipamọ Linux pinpin tirẹ ni ibi ipamọ lati fi ẹya tuntun ti MySQL sii (ie 8.0 ti o jade ni 27 Keje 2018).

--------------- On RHEL/CentOS 8 ---------------
# wget https://repo.mysql.com/mysql80-community-release-el8-1.noarch.rpm
--------------- On RHEL/CentOS 7 ---------------
# wget https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
--------------- On RHEL/CentOS 6 ---------------
# wget https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm
--------------- On Fedora 30 ---------------
# wget https://dev.mysql.com/get/mysql80-community-release-fc30-1.noarch.rpm
--------------- On Fedora 29 ---------------
# wget https://dev.mysql.com/get/mysql80-community-release-fc29-1.noarch.rpm
--------------- On Fedora 28 ---------------
# wget https://dev.mysql.com/get/mysql80-community-release-fc28-1.noarch.rpm

3. Lẹhin ti o ti ṣajọpọ package fun pẹpẹ Linux rẹ, ni bayi fi package ti o gbasilẹ sii pẹlu aṣẹ atẹle.

--------------- On RHEL/CentOS 8 ---------------
# yum localinstall mysql80-community-release-el8-1.noarch.rpm
--------------- On RHEL/CentOS 7 ---------------
# yum localinstall mysql80-community-release-el7-1.noarch.rpm
--------------- On RHEL/CentOS 6 ---------------
# yum localinstall mysql80-community-release-el6-1.noarch.rpm
--------------- On Fedora 30 ---------------
# dnf localinstall mysql80-community-release-fc30-1.noarch.rpm
--------------- On Fedora 29 ---------------
# dnf localinstall mysql80-community-release-fc29-1.noarch.rpm
--------------- On Fedora 28 ---------------
# yum localinstall mysql80-community-release-fc28-1.noarch.rpm

Aṣẹ fifi sori ẹrọ ti o wa loke ṣafikun ibi ipamọ MySQL Yum si atokọ ibi ipamọ eto ati gbigba lati ayelujara bọtini GnuPG lati rii daju iduroṣinṣin ti awọn idii.

4. O le rii daju pe ibi ipamọ MySQL Yum ti ṣafikun ni aṣeyọri nipa lilo pipaṣẹ atẹle.

# yum repolist enabled | grep "mysql.*-community.*"
# dnf repolist enabled | grep "mysql.*-community.*"      [On Fedora versions]

Igbesẹ 2: Fifi Ẹya MySQL Tuntun sii

5. Fi ẹya tuntun ti MySQL sii (lọwọlọwọ 8.0) ni lilo pipaṣẹ atẹle.

# yum install mysql-community-server
# dnf install mysql-community-server      [On Fedora versions]

Aṣẹ ti o wa loke nfi gbogbo awọn idii ti o nilo sii fun olupin MySQL olupin mysql-server, mysql-community-client, mysql-community-common ati mysql-community-libs.

Igbesẹ 3: Fifi jara Jade ti MySQL sii

6. O tun le fi oriṣiriṣi awọn ẹya MySQL sori ẹrọ nipa lilo oriṣiriṣi awọn ibi-ipamọ ti MySQL Community Server. Ibi-ipamọ fun jara MySQL to ṣẹṣẹ (MySQL 8.0 lọwọlọwọ) ti muu ṣiṣẹ nipasẹ aiyipada, ati awọn ibi-ipamọ fun gbogbo awọn ẹya miiran (fun apẹẹrẹ, jara MySQL 5.x) ti wa ni pipa nipasẹ aiyipada.

Lati fi ẹya kan pato sii lati ibi ipamọ kekere kan pato, o le lo --enable tabi --disable awọn aṣayan nipa lilo yum-config-manager tabi dnf config-manager bi o ti han:

# yum-config-manager --disable mysql57-community
# yum-config-manager --enable mysql56-community
------------------ Fedora Versions ------------------
# dnf config-manager --disable mysql57-community
# dnf config-manager --enable mysql56-community

Igbese 4: Bibẹrẹ Server MySQL

7. Lẹhin fifi sori aṣeyọri ti MySQL, o to akoko lati bẹrẹ olupin MySQL pẹlu aṣẹ atẹle:

# service mysqld start

O le ṣayẹwo ipo ti olupin MySQL pẹlu iranlọwọ ti aṣẹ atẹle.

# service mysqld status

Eyi ni iṣafihan apẹẹrẹ ti ṣiṣe MySQL labẹ apoti mi CentOS 7.

Redirecting to /bin/systemctl status  mysqld.service
mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
   Active: active (running) since Thu 2015-10-29 05:15:19 EDT; 4min 5s ago
  Process: 5314 ExecStart=/usr/sbin/mysqld --daemonize $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 5298 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 5317 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─5317 /usr/sbin/mysqld --daemonize

Oct 29 05:15:19 localhost.localdomain systemd[1]: Started MySQL Server.

8. Bayi nikẹhin ṣayẹwo iru ẹya MySQL ti a fi sii nipa lilo pipaṣẹ atẹle.

# mysql --version

mysql  Ver 8.0.12 for Linux on x86_64 (MySQL Community Server - GPL)

Igbesẹ 5: Ṣiṣe aabo sori Fifi sori MySQL

9. Aṣẹ mysql_secure_installation n fun ọ laaye lati ni aabo fifi sori MySQL rẹ nipasẹ ṣiṣe awọn eto pataki bi siseto ọrọ igbaniwọle, yiyọ awọn olumulo alailorukọ, yiyọ wiwọle root, ati bẹbẹ lọ.

Akiyesi: Ẹya MySQL 8.0 tabi ga julọ ṣe gbogbo ọrọ igbaniwọle laileto fun igba diẹ ni /var/log/mysqld.log lẹhin fifi sori ẹrọ.

Lo pipaṣẹ ti o wa ni isalẹ lati wo ọrọ igbaniwọle ṣaaju ṣiṣe aṣẹ aabo MySQL.

# grep 'temporary password' /var/log/mysqld.log

Lọgan ti o ba mọ ọrọ igbaniwọle o le ṣiṣe ni atẹle atẹle lati ni aabo fifi sori MySQL rẹ.

# mysql_secure_installation

Akiyesi: Tẹ ọrọ igbaniwọle Gbongbo tuntun tumọ si ọrọ igbaniwọle igba diẹ rẹ lati faili kan /var/log/mysqld.log .

Bayi tẹle awọn itọnisọna loju iboju ni pẹlẹpẹlẹ, fun itọkasi wo abajade ti aṣẹ loke ni isalẹ.

Securing the MySQL server deployment.

Enter password for user root: Enter New Root Password

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Using existing password for root.

Estimated strength of the password: 50 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password: Set New MySQL Password

Re-enter new password: Re-enter New MySQL 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
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.


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.

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.

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! 

Igbesẹ 6: Nsopọ si Server MySQL

10. Nsopọ si olupin MySQL tuntun ti a fi sii nipa fifun orukọ olumulo ati ọrọ igbaniwọle.

# mysql -u root -p
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 8.0.1 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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>

Igbesẹ 7: Nmu MySQL dojuiwọn pẹlu Yum

11. Yato fifi sori tuntun, o tun le ṣe awọn imudojuiwọn fun awọn ọja MySQL ati awọn paati pẹlu iranlọwọ ti aṣẹ atẹle.

# yum update mysql-server
# dnf update mysql-server       [On Fedora versions]

Nigbati awọn imudojuiwọn tuntun ba wa fun MySQL, yoo fi sii wọn laifọwọyi, ti kii ba ṣe bẹ iwọ yoo gba ifiranṣẹ ti o sọ KO awọn idii ti a samisi fun awọn imudojuiwọn.

Iyẹn ni, o ti ṣaṣeyọri fi sori ẹrọ MySQL 8.0 sori ẹrọ rẹ. Ti o ba ni wahala eyikeyi fifi sori ẹrọ ni ominira lati lo apakan asọye wa fun awọn solusan.