Giunsa ang Pag-install sa MySQL 8.0 sa RHEL/CentOS 8/7 ug Fedora 35


Ang MySQL usa ka open-source nga libre nga relational database management system (RDBMS) nga gipagawas ubos sa GNU (General Public License). Gigamit kini sa pagpadagan og daghang mga database sa bisan unsang server pinaagi sa paghatag og multi-user access sa matag gibuhat nga database.

Kini nga artikulo maglakaw pinaagi kanimo sa proseso sa pag-instalar ug pag-update sa pinakabag-o nga bersyon sa MySQL 8.0 sa RHEL/CentOS 8/7/6/ ug Fedora gamit ang MySQL Yum repository pinaagi sa YUM utility.

Lakang 1: Pagdugang sa MySQL Yum Repository

1. Atong gamiton ang opisyal nga MySQL Yum software repository, nga maghatag ug RPM packages para sa pag-instalar sa pinakabag-o nga bersyon sa MySQL server, client, MySQL Utilities, MySQL Workbench, Connector/ODBC, ug Connector/Python para sa RHEL/CentOS 8/7 /6/ ug Fedora 30-35.

Importante: Kini nga mga instruksyon magamit lamang sa bag-ong pag-instalar sa MySQL sa server, kung aduna nay MySQL nga na-install gamit ang third-party-distributed RPM package, unya girekomendar ko nimo nga i-upgrade o ilisan ang na-install nga MySQL package gamit ang MySQL Yum Repository ”.

Sa wala pa ang Pag-upgrade o Pag-ilis sa usa ka daan nga MySQL nga pakete, ayaw kalimti ang pagkuha sa tanan nga importante nga database backup ug configuration files gamit ang among Backup MySQL Databases nga giya.

2. Karon i-download ug idugang ang mosunod nga MySQL Yum repository sa imong tagsa-tagsa ka Linux distribution system’s repository list aron i-install ang pinakabag-o nga bersyon sa MySQL (ie 8.0 nga gipagawas sa 27 July 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. Human ma-download ang package para sa imong Linux platform, karon i-install ang na-download nga package gamit ang mosunod nga command.

--------------- 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

Ang sugo sa pag-install sa ibabaw nagdugang sa MySQL Yum repository sa listahan sa repository sa sistema ug nag-download sa GnuPG key aron masusi ang integridad sa mga pakete.

4. Mahimo nimong pamatud-an nga ang MySQL Yum repository nadugang nga malampuson pinaagi sa paggamit sa mosunod nga sugo.

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

Lakang 2: Pag-instalar sa Pinakabag-ong Bersyon sa MySQL

5. I-install ang pinakabag-o nga bersyon sa MySQL (karon 8.0) gamit ang mosunod nga sugo.

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

Ang sugo sa ibabaw nag-instalar sa tanang gikinahanglan nga mga pakete alang sa MySQL server mysql-community-server, mysql-community-client, mysql-community-common ug mysql-community-libs.

Lakang 3: Pag-instalar sa Lahi nga MySQL Release Bersyon

6. Mahimo usab nimo nga i-install ang lainlaing mga bersyon sa MySQL gamit ang lainlaing mga sub-repositories sa MySQL Community Server. Ang sub-repository para sa bag-o nga MySQL series (karon MySQL 8.0) kay gi-activate pinaagi sa default, ug ang mga sub-repository para sa tanang ubang bersyon (pananglitan, ang MySQL 5.x series) gi-deactivate pinaagi sa default.

Aron ma-install ang usa ka piho nga bersyon gikan sa usa ka piho nga sub-repository, mahimo nimong gamiton ang --enable o --disable nga mga kapilian gamit ang yum-config-manager o dnf config-manager sama sa gipakita. :

# 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

Lakang 4: Pagsugod sa MySQL Server

7. Human sa malampuson nga pag-instalar sa MySQL, panahon na nga magsugod ug makapahimo sa MySQL server sa mosunod nga mga sugo:

# service mysqld start
# systemctl enable mysqld.service

Mahimo nimong pamatud-an ang kahimtang sa MySQL server sa tabang sa mosunod nga sugo.

# systemctl status mysqld.service
OR
# service mysqld status

Kini ang sample nga output sa pagpadagan sa MySQL ubos sa akong CentOS 7 nga kahon.

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. Karon sa katapusan pamatud-i ang na-install nga MySQL nga bersyon gamit ang mosunod nga sugo.

# mysql --version

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

Lakang 5: Pagsiguro sa Pag-install sa MySQL

9. Ang command mysql_secure_installation nagtugot kanimo sa pag-secure sa imong MySQL installation pinaagi sa paghimo sa importante nga mga setting sama sa pag-set sa root password, pagtangtang sa anonymous nga tiggamit, pagtangtang sa root login, ug uban pa.

Mubo nga sulat: Ang MySQL nga bersyon 8.0 o mas taas nagmugna og temporaryo nga random nga password sa /var/log/mysqld.log human sa pag-instalar.

Gamita ang ubos nga sugo aron makita ang password sa dili pa magpadagan sa MySQL secure command.

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

Kung nahibal-an na nimo ang password mahimo nimong ipadagan ang mosunud nga mando aron ma-secure ang imong pag-install sa MySQL.

# mysql_secure_installation

Pahinumdom: Pagsulod ug bag-ong Root password nagpasabot sa imong temporaryong password gikan sa file /var/log/mysqld.log.

Karon sunda ang mga instruksyon sa onscreen pag-ayo, alang sa pakisayran tan-awa ang output sa sugo sa ibabaw sa ubos.

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! 

Lakang 6: Pagkonektar sa MySQL Server

10. Sumpaysumpaya ang bag-ong na-install nga MySQL server pinaagi sa paghatag og username ug 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>

Lakang 7: Pag-update sa MySQL gamit ang Yum

11. Gawas sa presko nga pag-instalar, mahimo ka usab nga maghimo og mga update alang sa MySQL nga mga produkto ug mga sangkap sa tabang sa mosunod nga sugo.

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

Kung ang mga bag-ong update magamit alang sa MySQL, kini awtomatiko nga i-install kini, kung dili makadawat ka usa ka mensahe nga nag-ingon nga WALA nga mga pakete nga gimarkahan alang sa mga update.

Mao kana, malampuson nimo nga na-install ang MySQL 8.0 sa imong sistema. Kung adunay ka problema sa pag-install mobati nga gawasnon nga gamiton ang among seksyon sa komento alang sa mga solusyon.