Welcome to our guide on how to install MySQL 8 on Fedora 30/Fedora 29. Check what is new in MySQL 8 for a number of features that it brings about.
Install MySQL 8 on Fedora 30/Fedora 29
Before you can begin your installation, run system update to resynchronize packages to their latest versions.
dnf update
dnf upgrade
Add MySQL YUM Repository
To install MySQL 8 on Fedora 30/Fedora 29, you need to add MySQL YUM repository. Hence, install the repositories as shown below;
On Fedora 30
dnf install https://repo.mysql.com//mysql80-community-release-fc30-1.noarch.rpm
On Fedora 29
dnf install https://repo.mysql.com//mysql80-community-release-fc29-2.noarch.rpm
Install MySQL 8 on Fedora 30/Fedora 29
Once the repositories are installed, you can now install MySQL 8 by executing the command below;
dnf install mysql-community-server
Running MySQL 8
Once the installation is done, you can start and enable MySQL 8 to run on system boot by running the commands below;
systemctl start mysqld
systemctl enable mysqld
Extract root User Password
When run initially, MySQL server is initialized, SSL certificate and key files are generated in the data directory, validate_password
is installed and enabled and a password for the root user is set and stored in the error log file. To extract the password, use the following command:
grep -i "temporary password" /var/log/mysqld.log
You should see a line with a password for root user similar to the one below;
2019-06-20T09:06:44.132478Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: IAjfHuqme8&.
The password in this case is; IAjfHuqme8&.
Change MySQL root Password
As a security measure, ensure that you change the password as soon as possible. Login as root user with the temporary generated password that you extract above.
Note that, since the validate_password policy is enabled, your password should contain at least one upper case letter, one lower case letter, one digit, and one special character, and that the total password length is at least 8 characters.
mysql -u root -p
Enter password: IAjfHuqme8&.
Use the temporary password extracted above.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.16
Copyright (c) 2000, 2019, 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>
Next, run the command below to reset the password.
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyStr0ngPassword#8';
MySQL Installation security
Next, you can run initial MySQL security using the mysql_secure_installation script. This scripts helps in setting a password for root user, disable root use remote login, remove anonymous database users, removes test databases.
mysql_secure_installation
Since we have reset the password, login in with your new password. You can as well choose to reset the password or leave the newly created password.
Securing the MySQL server deployment.
Enter password for user root:
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
Change the password for root ? ((Press y|Y for Yes, any other key for No) : N
... skipping.
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!
To confirm that you are running MySQL 8 on Fedora 30/Fedora 29, login to MySQL and execute the command, SELECT version();
mysql -u root -p
mysql> SELECT version();
+-----------+
| version() |
+-----------+
| 8.0.16 |
+-----------+
1 row in set (0.00 sec)
Well, you are now running MySQL 8.0.16 on Fedora 30/Fedora 29. Enjoy;
Other related guides;
Install LAMP Stack on Fedora 30
How To Install LAMP (Linux, Apache, MySQL, PHP) Stack on Fedora 28/29
Install MariaDB 10.3 on CentOS 7
Thank you for this article. I’ve got mysql running on my machine now.