4

How To Install MySQL 5.7 on Fedora 34/33/32/31/30

 3 years ago
source link: https://computingforgeeks.com/how-to-install-mysql-5-7-on-fedora/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
How To Install MySQL 5.7 on Fedora 34/33/32/31/30
Search

Question: How can I install MySQL 5.7 on Fedora 34/33/32/31/30/29?. MySQL is the most robust production-grade RDBMS based on Structured Query Language (SQL). Its development is backed by Oracle Corporation. With its proven reliability, performance, and ease-of-use, MySQL has become the leading database choice for web-based applications.

install mysql 5.7 fedora

Some big companies using MySQL includes Facebook, Twitter, YouTube, and many others. MySQL has a huge user community behind it, so you can always get help when you need one.

Step 1: Install MySQL 5.7 on Fedora 34/33/32/31/30

The packages for MySQL 5.7 are available on Oracle upstream repositories for Fedora. Add the repository using the following commands – specific to each distribution.

Add MySQL 8.0 repository to Fedora 34:

sudo dnf -y install https://dev.mysql.com/get/mysql80-community-release-fc34-1.noarch.rpm

Add MySQL 8.0 repository to Fedora 33:

sudo dnf -y install https://dev.mysql.com/get/mysql80-community-release-fc33-1.noarch.rpm

Add MySQL 8.0 repository to Fedora 32

sudo dnf -y install https://dev.mysql.com/get/mysql80-community-release-fc32-1.noarch.rpm

Add MySQL 8.0 repository to Fedora 31

sudo dnf -y install https://repo.mysql.com//mysql80-community-release-fc31-1.noarch.rpm

For Fedora 30:

sudo dnf -y install https://repo.mysql.com//mysql80-community-release-fc30-1.noarch.rpm

For Fedora 29:

sudo dnf -y install https://repo.mysql.com//mysql80-community-release-fc29-2.noarch.rpm

The commands above will add repository contents to the file /etc/yum.repos.d/mysql-community.repo.

The default package mysql-community-server installed is for MySQL 8. To install MySQL 5.7 on Fedora 32/31/30/29.

Disable MySQL 8 repository:

sudo dnf config-manager --disable mysql80-community

Then enable channel for MySQL 5.7.

sudo dnf config-manager --enable mysql57-community

Then install MySQL 5.7 on Fedora:

sudo dnf install mysql-community-server

Press “y” key to start the installation.

...........................................
Transaction Summary
Install  49 Packages
Total download size: 214 M
Installed size: 970 M
Is this ok [y/N]: y

Also Agree to add GPG key.

Importing GPG key 0x5072E1F5:
 Userid     : "MySQL Release Engineering <[email protected]>"
 Fingerprint: A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 E1F5
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y

If this fails add repository for MySQL 5.7 manually:

sudo tee /etc/yum.repos.d/mysql-community-5.7.repo<<EOF
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/
enabled=1
gpgcheck=0
EOF

Then install MySQL 5.7 on Fedora 32/31/30/29:

sudo dnf config-manager --disable mysql80-community
sudo dnf config-manager --enable mysql57-community
sudo dnf install mysql-community-server

Hit the Y key to start installation:

Transaction Summary
==================================================================================================================================================================
Install  48 Packages

Total download size: 213 M
Installed size: 914 M
Is this ok [y/N]: y

To view installed package specific details, use:

$ rpm -qi mysql-community-server
Name        : mysql-community-server
Version     : 5.7.31
Release     : 1.el7
Architecture: x86_64
Install Date: Mon 21 Sep 2020 10:33:07 AM UTC
Group       : Applications/Databases
Size        : 798880218
License     : Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Under GPLv2 license as shown in the Description field.
Signature   : DSA/SHA1, Wed 03 Jun 2020 10:08:07 AM UTC, Key ID 8c718d3b5072e1f5
Source RPM  : mysql-community-5.7.31-1.el7.src.rpm
Build Date  : Tue 02 Jun 2020 11:48:16 AM UTC
Build Host  : siv27.no.oracle.com
Packager    : MySQL Release Engineering <[email protected]>
Vendor      : Oracle and/or its affiliates
URL         : http://www.mysql.com/
Summary     : A very fast and reliable SQL database server

Step 2: Configure MySQL 5.7 on Fedora 34/33/32/31/30

2.1 – After the installation, start mysqld service.

sudo systemctl enable --now mysqld.service

2.2 – Copy the generated random password for the root user:

sudo grep 'A temporary password' /var/log/mysqld.log |tail -1

Take note of the printed password:

2019-05-08T16:59:02.412078Z 1 [Note] A temporary password is generated for root@localhost: -gv9kyqud*,U

2.3 – Start MySQL Secure Installation to change the root password, Disallow root login remotely, remove anonymous users and remove test database.

$ sudo mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:

Authenticate with your generated temporary password. This will ask you to set a new password for the root user.

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

New password: 
Re-enter new password: 

Estimated strength of the password: 100 
Do you wish to continue with the password provided?: Yes

Remove anonymous users?: Yes
Success.

Disallow root login remotely? : Yes
Success.

Remove test database and access to it? : Yes
 - Dropping test database...
Success.
 - Removing privileges on test database...
Success.

Reload privilege tables now? (Press y|Y for Yes) : Yes
Success.

All done!

You can use online password generator to get a complex password.

2.4 – Connect to MySQL Database as root user and create a test database.

$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.31 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> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.7.31    |
+-----------+
1 row in set (0.00 sec)

mysql> \q
Bye

2.5 – Create a test database and user:

mysql> CREATE DATABASE test_db;
Query OK, 1 row affected (0.09 sec)

mysql> CREATE USER 'test_user'@'localhost' IDENTIFIED BY "Strong34S;#";
Query OK, 0 rows affected (0.04 sec)

mysql> GRANT ALL PRIVILEGES ON test_db.* TO 'test_user'@'localhost';
Query OK, 0 rows affected (0.02 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)

This test database and user can be dropped by running:

mysql> DROP DATABASE test_db;
Query OK, 0 rows affected (0.14 sec)

mysql> DROP USER 'test_user'@'localhost';
Query OK, 0 rows affected (0.11 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)

mysql> QUIT
Bye

Step 3: Configure Firewall

To allow for remote connections, allow port 3306 on the firewall

sudo firewall-cmd --add-service=mysql --permanent
sudo firewall-cmd --reload

You can also limit access from trusted networks

sudo firewall-cmd --permanent --add-rich-rule 'rule family="ipv4" \
service name="mysql" source address="10.10.10.0/24" accept'

Thanks for installing MySQL 5.7 on Fedora 34/33/32/31/30/29 using our guide. Until next time, stay connected.

MySQL learning video courses:

Other MySQL articles:

How To Install MySQL 8 on Fedora

How to convert all MySQL tables from MyISAM into InnoDB Storage engine

How to solve “MySQL server is running with the –secure-file-priv” Error

How to find database sizes in MySQL/MariaDB Database Server


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK