Install MySQL to configure Database Server.
[1] Install and Configure MySQL.
# Install MySQL server
[root@futurelinux ~]# dnf install mysql-server -y
# Let's configure the MySQL directory.
[root@futurelinux ~]# mysqld --initialize --user=mysql --datadir=/var/lib/mysql
# Let's set the directory / file permissions
[root@futurelinux ~]# chown -R mysql:mysql /var/lib/mysql
# If SELinux is active, let's fix the policy contexts.
[root@futurelinux ~]# restorecon -Rv /var/lib/mysql
# Let's start with root rights to set a password
[root@futurelinux ~]# mysqld --skip-grant-tables --skip-networking --user root &
# login as root without password
[root@futurelinux ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 7
Server version: 8.0.22 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>
# use mysql database
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
# unlock account
mysql> update mysql.user set account_locked='N' where User='root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
# password does not expire
mysql> update mysql.user set password_expired='N' where User='root';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0
# authentication_string is null
mysql> UPDATE mysql.user SET authentication_string=null WHERE User='root';
Query OK, 1 row affected (0.03 sec)
Rows matched: 1 Changed: 1 Warnings: 0
# apply changes
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)
# Set the MySQL root password
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'futurelinux';
Query OK, 0 rows affected (0.02 sec)
# apply changes
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)
mysql> quit
Bye
# kill the process
[root@futurelinux ~]# killall mysqld
[root@futurelinux ~]# killall mysqld
mysqld: no process found
[1]+ Done mysqld --skip-grant-tables --skip-networking --user root
# file ownership check
[root@futurelinux ~]# chown mysql:mysql -R /var/lib/mysql
[root@futurelinux ~]# chown mysql:mysql -R /var/run/mysqld
[root@futurelinux ~]# chown mysql:mysql /var/log/mysqld.log
# Add to startup services and start
[root@futurelinux ~]# systemctl enable mysqld
[root@futurelinux ~]# systemctl start mysqld