{"id":13889,"date":"2022-09-06T13:41:57","date_gmt":"2022-09-06T10:41:57","guid":{"rendered":"https:\/\/kifarunix.com\/?p=13889"},"modified":"2024-03-09T21:31:16","modified_gmt":"2024-03-09T18:31:16","slug":"install-mysql-8-on-oracle-linux","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-mysql-8-on-oracle-linux\/","title":{"rendered":"Install MySQL 8 on Oracle Linux 9"},"content":{"rendered":"\n
Follow through this tutorial to learn how to install MySQL 8 on Oracle Linux 9. Being a popular open-source relational database management system, MySQL is available and can be installed on Oracle Linux 9.<\/p>\n\n\n\n
MySQL 8 package is provided by Oracle Linux 9 AppStream repos. The default Oracle Linuix AppStream repositories however may not provide the latest release version of MySQL 8 packages.<\/p>\n\n\n\n
dnf provides mysql-server<\/code><\/pre>\n\n\n\nmysql-server-8.0.28-1.el9.x86_64 : The MySQL server and related files\nRepo : ol9_appstream\nMatched from:\nProvide : mysql-server = 8.0.28-1.el9<\/code><\/pre>\n\n\n\nAs you can see from the output above, Oracle Linux AppStream repository provides MySQL 8.0.28 whereas the current MySQL 8 release<\/a>, as of this writing<\/strong>, is MySQL 8.0.30.<\/p>\n\n\n\nIn order to ensure that you install latest release version of MySQL 8 on Oracle Linux, you need to install MySQL Yum repository. Thus, navigate to MySQL Yum repository downloads page<\/a> and grab the repository release package for your platform.<\/p>\n\n\n\nYou can as well get the download link and install it directly as follows;<\/p>\n\n\n\n
sudo dnf install https:\/\/repo.mysql.com\/\/mysql80-community-release-el9-1.noarch.rpm<\/code><\/pre>\n\n\n\nOnce the installation is done, you can verify the version of the available MySQL 8 package;<\/p>\n\n\n\n
dnf provides mysql-server<\/code><\/pre>\n\n\n\nMySQL 8.0 Community Server 137 kB\/s | 210 kB 00:01 \nMySQL Connectors Community 287 B\/s | 257 B 00:00 \nMySQL Tools Community 51 kB\/s | 57 kB 00:01 \nmysql-community-server-8.0.30-1.el9.x86_64 : A very fast and reliable SQL database server\nRepo : mysql80-community\nMatched from:\nProvide : mysql-server = 8.0.30-1.el9\n\nmysql-server-8.0.28-1.el9.x86_64 : The MySQL server and related files\nRepo : ol9_appstream\nMatched from:\nProvide : mysql-server = 8.0.28-1.el9\n<\/code><\/pre>\n\n\n\nAs a result, you can now install MySQL 8 by running the command below;<\/p>\n\n\n\n
dnf install mysql-server<\/code><\/pre>\n\n\n\nDependencies resolved.\n============================================================================================================================================================================\n Package Architecture Version Repository Size\n============================================================================================================================================================================\nInstalling:\n mysql-community-server x86_64 8.0.30-1.el9 mysql80-community 48 M\nInstalling dependencies:\n mysql-community-client x86_64 8.0.30-1.el9 mysql80-community 3.7 M\n mysql-community-client-plugins x86_64 8.0.30-1.el9 mysql80-community 1.4 M\n mysql-community-common x86_64 8.0.30-1.el9 mysql80-community 534 k\n mysql-community-icu-data-files x86_64 8.0.30-1.el9 mysql80-community 2.2 M\n mysql-community-libs x86_64 8.0.30-1.el9 mysql80-community 1.5 M\n perl-Carp noarch 1.50-460.el9 ol9_appstream 34 k\n perl-Class-Struct noarch 0.66-479.el9 ol9_appstream 32 k\n perl-Encode x86_64 4:3.08-462.el9 ol9_appstream 1.8 M\n perl-Errno x86_64 1.30-479.el9 ol9_appstream 24 k\n perl-Exporter noarch 5.74-461.el9 ol9_appstream 37 k\n perl-Fcntl x86_64 1.13-479.el9 ol9_appstream 30 k\n perl-File-Basename noarch 2.85-479.el9 ol9_appstream 27 k\n perl-File-Path noarch 2.18-4.el9 ol9_appstream 36 k\n perl-File-Temp noarch 1:0.231.100-4.el9 ol9_appstream 67 k\n perl-File-stat noarch 1.09-479.el9 ol9_appstream 27 k\n perl-Getopt-Long noarch 1:2.52-4.el9 ol9_appstream 71 k\n perl-Getopt-Std noarch 1.12-479.el9 ol9_appstream 25 k\n perl-HTTP-Tiny noarch 0.076-460.el9 ol9_appstream 63 k\n perl-IO x86_64 1.43-479.el9 ol9_appstream 119 k\n perl-IPC-Open3 noarch 1.21-479.el9 ol9_appstream 32 k\n perl-MIME-Base64 x86_64 3.16-4.el9 ol9_appstream 38 k\n perl-POSIX x86_64 1.94-479.el9 ol9_appstream 106 k\n perl-PathTools x86_64 3.78-461.el9 ol9_appstream 108 k\n perl-Pod-Escapes noarch 1:1.07-460.el9 ol9_appstream 21 k\n perl-Pod-Perldoc noarch 3.28.01-461.el9 ol9_appstream 116 k\n perl-Pod-Simple noarch 1:3.42-4.el9 ol9_appstream 272 k\n perl-Pod-Usage noarch 4:2.01-4.el9 ol9_appstream 48 k\n perl-Scalar-List-Utils x86_64 4:1.56-461.el9 ol9_appstream 83 k\n perl-SelectSaver noarch 1.02-479.el9 ol9_appstream 21 k\n perl-Socket x86_64 4:2.031-4.el9 ol9_appstream 62 k\n perl-Storable x86_64 1:3.21-460.el9 ol9_appstream 100 k\n perl-Symbol noarch 1.08-479.el9 ol9_appstream 24 k\n perl-Term-ANSIColor noarch 5.01-461.el9 ol9_appstream 54 k\n perl-Term-Cap noarch 1.17-460.el9 ol9_appstream 27 k\n perl-Text-ParseWords noarch 3.30-460.el9 ol9_appstream 17 k\n perl-Text-Tabs+Wrap noarch 2013.0523-460.el9 ol9_appstream 29 k\n perl-Time-Local noarch 2:1.300-7.el9 ol9_appstream 41 k\n perl-constant noarch 1.33-461.el9 ol9_appstream 28 k\n perl-if noarch 0.60.800-479.el9 ol9_appstream 23 k\n perl-interpreter x86_64 4:5.32.1-479.el9 ol9_appstream 86 k\n perl-libs x86_64 4:5.32.1-479.el9 ol9_appstream 2.7 M\n perl-mro x86_64 1.23-479.el9 ol9_appstream 38 k\n perl-overload noarch 1.31-479.el9 ol9_appstream 55 k\n perl-overloading noarch 0.02-479.el9 ol9_appstream 22 k\n perl-parent noarch 1:0.238-460.el9 ol9_appstream 15 k\n perl-podlators noarch 1:4.14-460.el9 ol9_appstream 135 k\n perl-subs noarch 1.03-479.el9 ol9_appstream 21 k\n perl-vars noarch 1.05-479.el9 ol9_appstream 23 k\n\nTransaction Summary\n============================================================================================================================================================================\nInstall 49 Packages\n\nTotal download size: 64 M\nInstalled size: 352 M\nIs this ok [y\/N]: y\n<\/code><\/pre>\n\n\n\nRunning MySQL 8 on Oracle Linux 9<\/h3>\n\n\n\n
You can start and enable MySQL 8 server to run on system boot after the installation.<\/p>\n\n\n\n
sudo systemctl enable --now mysqld<\/code><\/pre>\n\n\n\nTo check the status of MySQL 8 server;<\/p>\n\n\n\n
systemctl status mysqld<\/code><\/pre>\n\n\n\n\u25cf mysqld.service - MySQL Server\n Loaded: loaded (\/usr\/lib\/systemd\/system\/mysqld.service; enabled; vendor preset: disabled)\n Active: active (running) since Tue 2022-09-06 08:59:55 EAT; 8s ago\n Docs: man:mysqld(8)\n http:\/\/dev.mysql.com\/doc\/refman\/en\/using-systemd.html\n Process: 28142 ExecStartPre=\/usr\/bin\/mysqld_pre_systemd (code=exited, status=0\/SUCCESS)\n Main PID: 28219 (mysqld)\n Status: \"Server is operational\"\n Tasks: 39 (limit: 5832)\n Memory: 424.4M\n CPU: 5.039s\n CGroup: \/system.slice\/mysqld.service\n \u2514\u250028219 \/usr\/sbin\/mysqld\n\nSep 06 08:59:43 localhost.localdomain systemd[1]: Starting MySQL Server...\nSep 06 08:59:55 localhost.localdomain systemd[1]: Started MySQL Server.\n<\/code><\/pre>\n\n\n\nOracle Linux MySQL 8 Initial Security<\/h3>\n\n\n\n
When the MySQL service is started for the first time;<\/p>\n\n\n\n
\n- The MySQL server is initialized.<\/em><\/li>\n\n\n\n
- SSL certificate and key files are generated in the data directory.<\/em><\/li>\n\n\n\n
validate_password<\/code> is installed and enabled.<\/em><\/li>\n\n\n\n- A superuser account
'root'@'localhost<\/code> is created.<\/em><\/li>\n\n\n\n- A password for the superuser is set and stored in the error log file<\/em>.<\/li>\n<\/ul>\n\n\n\n
Before you can begin to use MySQL, it is recommended that you ran the initial secure installation script. The script is used to remove test MySQL server databases, remove anonymous users in the database, disable remote root login, set the password strength.<\/p>\n\n\n\n
Before you can run the MySQL secure installation script, you need to obtain the root password that was set when the MySQL server was initialized.<\/p>\n\n\n\n
sudo grep 'temporary password' \/var\/log\/mysqld.log<\/code><\/pre>\n\n\n\nSample output;<\/p>\n\n\n\n
2022-09-06T05:59:49.712475Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: =moSFn9Djmdj<\/strong><\/code><\/pre>\n\n\n\nOnce you have the password, run the script by simply executing the command;<\/p>\n\n\n\n
mysql_secure_installation<\/code><\/pre>\n\n\n\nEnter the password extracted above, when prompted.<\/p>\n\n\n\n
Next, change the password and proceed to remove anonymous user, disallow remote root login, remove test databases and reload privilege tables.<\/p>\n\n\n\n
\nSecuring the MySQL server deployment.\n\nEnter password for user root: \n\nThe existing password for the user account root has expired. Please set a new password.\n\nNew password: \n\nRe-enter new password: \n ... Failed! Error: Your password does not satisfy the current policy requirements\n\nNew password: \n\nRe-enter new password: \nThe 'validate_password' component is installed on the server.\nThe subsequent steps will run with the existing configuration\nof the component.\nUsing existing password for root.\n\nEstimated strength of the password: 100\nChange the password for root ? ((Press y|Y for Yes, any other key for No) : n\n\n ... skipping.\nBy default, a MySQL installation has an anonymous user,\nallowing anyone to log into MySQL without having to have\na user account created for them. This is intended only for\ntesting, and to make the installation go a bit smoother.\nYou should remove them before moving into a production\nenvironment.\n\nRemove anonymous users? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\n\nNormally, root should only be allowed to connect from\n'localhost'. This ensures that someone cannot guess at\nthe root password from the network.\n\nDisallow root login remotely? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\nBy default, MySQL comes with a database named 'test' that\nanyone can access. This is also intended only for testing,\nand should be removed before moving into a production\nenvironment.\n\n\nRemove test database and access to it? (Press y|Y for Yes, any other key for No) : y\n - Dropping test database...\nSuccess.\n\n - Removing privileges on test database...\nSuccess.\n\nReloading the privilege tables will ensure that all changes\nmade so far will take effect immediately.\n\nReload privilege tables now? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\nAll done!\n<\/code><\/pre>\n\n\n\nYou can now login to your MySQL 8 server as a root user with the password set above.<\/p>\n\n\n\n
mysql -u root -p<\/code><\/pre>\n\n\n\n\nWelcome to the MySQL monitor. Commands end with ; or \\g.\nYour MySQL connection id is 20\nServer version: 8.0.30 MySQL Community Server - GPL\n\nCopyright (c) 2000, 2022, Oracle and\/or its affiliates.\n\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nmysql>\n<\/code><\/pre>\n\n\n\nTo show MySQL version, you can run the query;<\/p>\n\n\n\n
show variables like \"version%\";<\/code><\/pre>\n\n\n\n\n+-------------------------+------------------------------+\n| Variable_name | Value |\n+-------------------------+------------------------------+\n| version | 8.0.30 |\n| version_comment | MySQL Community Server - GPL |\n| version_compile_machine | x86_64 |\n| version_compile_os | Linux |\n| version_compile_zlib | 1.2.12 |\n+-------------------------+------------------------------+\n5 rows in set (0.01 sec)\n<\/code><\/pre>\n\n\n\nYou can as well run the command below on command line to show database version.<\/p>\n\n\n\n
mysql -V<\/code><\/pre>\n\n\n\nmysql Ver 8.0.30 for Linux on x86_64 (MySQL Community Server - GPL)<\/code><\/pre>\n\n\n\nThat is all on how to install MySQL 8 on Oracle Linux 9.<\/p>\n\n\n\n
Other Tutorials<\/h3>\n\n\n\n
Configure Guacamole MySQL Database Authentication<\/a><\/p>\n\n\n\n