Kif Tinstalla MySQL 8.0 fuq RHEL/CentOS 8/7 u Fedora 35


MySQL hija sistema ta' ġestjoni tad-database relazzjonali b'xejn b'sors miftuħ (RDBMS) rilaxxata taħt GNU (Liċenzja Pubblika Ġenerali). Jintuża biex iħaddem databases multipli fuq kwalunkwe server wieħed billi jipprovdi aċċess għal diversi utenti għal kull database maħluqa.

Dan l-artikolu ser jimxi miegħek il-proċess ta 'installazzjoni u aġġornament tal-aħħar verżjoni MySQL 8.0 fuq RHEL/CentOS 8/7/6/ u Fedora bl-użu tar-repożitorju MySQL Yum permezz tal-utilità YUM.

Pass 1: Żieda tar-Repożitorju MySQL Yum

1. Se nużaw ir-repożitorju tas-software MySQL Yum uffiċjali, li se jipprovdi pakketti RPM għall-installazzjoni tal-aħħar verżjoni tas-server MySQL, klijent, Utilitajiet MySQL, MySQL Workbench, Konnettur/ODBC, u Konnettur/Python għar-RHEL/CentOS 8/7 /6/ u Fedora 30-35.

Importanti: Dawn l-istruzzjonijiet jaħdmu biss fuq installazzjoni ġdida ta 'MySQL fuq is-server, jekk diġà hemm MySQL installat bl-użu ta' pakkett RPM distribwit minn parti terza, allura nirrakkomandalek li taġġorna jew tissostitwixxi l-pakkett MySQL installat billi tuża l-MySQL Yum Repository ”.

Qabel Taġġorna jew Tissostitwixxi pakkett MySQL antik, tinsiex tieħu l-backup tad-databases importanti kollha u l-fajls tal-konfigurazzjoni billi tuża l-gwida tagħna Backup MySQL Databases.

2. Issa niżżel u żid ir-repożitorju MySQL Yum li ġej mal-lista tar-repożitorji tas-sistema tad-distribuzzjoni Linux rispettiva tiegħek biex tinstalla l-aħħar verżjoni ta 'MySQL (jiġifieri 8.0 rilaxxata fis-27 ta' Lulju 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 35 ---------------
# wget https://dev.mysql.com/get/mysql80-community-release-fc35-1.noarch.rpm
--------------- On Fedora 34 ---------------
# wget https://dev.mysql.com/get/mysql80-community-release-fc34-1.noarch.rpm
--------------- On Fedora 33 ---------------
# wget https://dev.mysql.com/get/mysql80-community-release-fc33-1.noarch.rpm

3. Wara li tniżżel il-pakkett għall-pjattaforma Linux tiegħek, issa installa l-pakkett imniżżel bil-kmand li ġej.

--------------- 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 35 ---------------
# dnf localinstall mysql80-community-release-fc35-1.noarch.rpm
--------------- On Fedora 34 ---------------
# dnf localinstall mysql80-community-release-fc34-1.noarch.rpm
--------------- On Fedora 33 ---------------
# yum localinstall mysql80-community-release-fc33-1.noarch.rpm

Il-kmand tal-installazzjoni ta 'hawn fuq iżid ir-repożitorju MySQL Yum mal-lista tar-repożitorju tas-sistema u jniżżel iċ-ċavetta GnuPG biex tivverifika l-integrità tal-pakketti.

4. Tista 'tivverifika li r-repożitorju MySQL Yum ġie miżjud b'suċċess billi tuża l-kmand li ġej.

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

Pass 2: Installazzjoni tal-aħħar Verżjoni MySQL

5. Installa l-aħħar verżjoni ta 'MySQL (bħalissa 8.0) billi tuża l-kmand li ġej.

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

Il-kmand ta 'hawn fuq jinstalla l-pakketti kollha meħtieġa għas-server MySQL mysql-community-server, mysql-community-client, mysql-community-common u mysql-community-libs.

Pass 3: Installazzjoni ta 'Verżjonijiet ta' Rilaxx MySQL differenti

6. Tista' wkoll tinstalla verżjonijiet differenti ta' MySQL billi tuża sub-repożitorji differenti ta' MySQL Community Server. Is-sub-repożitorju għas-serje MySQL riċenti (bħalissa MySQL 8.0) huwa attivat awtomatikament, u s-sub-repożitorji għall-verżjonijiet l-oħra kollha (per eżempju, is-serje MySQL 5.x) huma diżattivati b'mod awtomatiku.

Biex tinstalla verżjoni speċifika minn sub-repożitorju speċifiku, tista' tuża l-għażliet --enable jew --disable billi tuża yum-config-manager jew dnf config-manager kif muri :

# 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

Pass 4: Tibda l-MySQL Server

7. Wara l-installazzjoni b'suċċess ta 'MySQL, wasal iż-żmien li tibda u tippermetti s-server MySQL bil-kmandi li ġejjin:

# service mysqld start
# systemctl enable mysqld.service

Tista 'tivverifika l-istatus tas-server MySQL bl-għajnuna tal-kmand li ġej.

# systemctl status mysqld.service
OR
# service mysqld status

Dan huwa l-output tal-kampjun tat-tħaddim tal-MySQL taħt il-kaxxa CentOS 7 tiegħi.

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. Issa finalment ivverifika l-verżjoni MySQL installata billi tuża l-kmand li ġej.

# mysql --version

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

Pass 5: Tiżgura l-Installazzjoni MySQL

9. Il-kmand mysql_secure_installation jippermettilek li tiżgura l-installazzjoni MySQL tiegħek billi twettaq settings importanti bħall-issettjar tal-password tal-għeruq, it-tneħħija ta 'utenti anonimi, it-tneħħija tal-login tal-għeruq, eċċ.

Nota: Il-verżjoni MySQL 8.0 jew ogħla tiġġenera password każwali temporanja f'/var/log/mysqld.log wara l-installazzjoni.

Uża l-kmand hawn taħt biex tara l-password qabel ma tħaddem kmand sigur MySQL.

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

Ladarba tkun taf il-password issa tista' tmexxi l-kmand li ġej biex tiżgura l-installazzjoni MySQL tiegħek.

# mysql_secure_installation

Nota: Daħħal password Root ġdida tfisser il-password temporanja tiegħek minn fajl /var/log/mysqld.log.

Issa segwi l-istruzzjonijiet fuq l-iskrin bir-reqqa, għal referenza ara l-output tal-kmand ta 'hawn fuq hawn taħt.

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! 

Pass 6: Konnessjoni ma 'MySQL Server

10. Qabbad ma' server MySQL li għadu kif ġie installat billi tipprovdi username u password.

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

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

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>

Pass 7: Aġġorna l-MySQL b'Yum

11. Minbarra installazzjoni friska, tista 'wkoll tagħmel aġġornamenti għal prodotti u komponenti MySQL bl-għajnuna tal-kmand li ġej.

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

Meta aġġornamenti ġodda jkunu disponibbli għall-MySQL, se tinstallahom awtomatikament, jekk le tirċievi messaġġ li jgħid LE pakketti mmarkati għall-aġġornamenti.

Dak hu, installajt b'suċċess MySQL 8.0 fis-sistema tiegħek. Jekk qed ikollok xi problemi biex tinstalla tħossok liberu li tuża t-taqsima tal-kummenti tagħna għal soluzzjonijiet.