{"id":336,"date":"2011-02-22T23:26:47","date_gmt":"2011-02-22T15:26:47","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=336"},"modified":"2023-04-28T09:50:42","modified_gmt":"2023-04-28T09:50:42","slug":"how-to-install-mysql-database-in-linux-using-yum","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-mysql-database-in-linux-using-yum\/","title":{"rendered":"How to Install MySQL Database in Linux Using Yum"},"content":{"rendered":"<p>MySQL is a widely used, open-source relational database management system. It is an essential component for many applications and websites. This guide will walk you through the process of installing MySQL on a Linux system using the YUM package manager.<\/p>\n<p>This guide is applicable to CentOS, RHEL, and other Linux distributions that use YUM as their package manager.<\/p>\n<h2>Step 1: Update YUM Repository<\/h2>\n<p>Before installing MySQL, it is a good practice to update the YUM repository to ensure that you are installing the latest available version:<\/p>\n<pre>\r\nsudo yum update\r\n<\/pre>\n<h2>Step 2: Install MySQL Community Repository<\/h2>\n<p>By default, MySQL is not available in the standard YUM repositories. You need to install the MySQL Community Repository to access MySQL packages:<\/p>\n<pre>\r\nsudo yum install https:\/\/dev.mysql.com\/get\/mysql80-community-release-el7-3.noarch.rpm\r\n<\/pre>\n<p>Please note that the URL may change with newer releases. You can find the latest MySQL Community Repository package for your distribution from the official MySQL website.<\/p>\n<h2>Step 3: Install MySQL Server<\/h2>\n<p>Now that the MySQL Community Repository is installed, you can use YUM to install the MySQL server package:<\/p>\n<pre>\r\nsudo yum install mysql-server\r\n<\/pre>\n<p>Example:<\/p>\n<pre class=\"code\">\r\nsudo yum install mysql-server\r\n\r\nLoaded plugins: fastestmirror\r\nLoading mirror speeds from cached hostfile\r\n * addons: ftp.oss.eznetsols.org\r\n * base: ftp.oss.eznetsols.org\r\n * epel: bali.idrepo.or.id\r\n * extras: ftp.oss.eznetsols.org\r\n * updates: ftp.oss.eznetsols.org\r\nSetting up Install Process\r\nResolving Dependencies\r\n--&gt; Running transaction check\r\n---&gt; Package mysql-server.x86_64 0:5.0.77-4.el5_5.4 set to be updated\r\n--&gt; Processing Dependency: mysql = 5.0.77-4.el5_5.4 for package: mysql-server\r\n--&gt; Processing Dependency: perl-DBD-MySQL for package: mysql-server\r\n--&gt; Running transaction check\r\n---&gt; Package mysql.x86_64 0:5.0.77-4.el5_5.4 set to be updated\r\n---&gt; Package perl-DBD-MySQL.x86_64 0:3.0007-2.el5 set to be updated\r\n--&gt; Finished Dependency Resolution\r\n\r\nDependencies Resolved\r\n\r\n================================================================================\r\n Package              Arch         Version                  Repository     Size\r\n================================================================================\r\nInstalling:\r\n mysql-server         x86_64       5.0.77-4.el5_5.4         updates       9.8 M\r\nInstalling for dependencies:\r\n perl-DBD-MySQL       x86_64       3.0007-2.el5             base          148 k\r\nUpdating for dependencies:\r\n mysql                x86_64       5.0.77-4.el5_5.4         updates       4.8 M\r\n\r\nTransaction Summary\r\n================================================================================\r\nInstall       2 Package(s)\r\nUpgrade       1 Package(s)\r\n\r\nTotal download size: 15 M\r\nIs this ok [y\/N]: y\r\nDownloading Packages:\r\n\r\n(1\/3): perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm            | 148 kB     00:17\r\n(2\/3): mysql-5.0.77-4.el5_5.4.x86_64.rpm                 | 4.8 MB     06:40\r\n(3\/3): mysql-server-5.0.77-4.el5_5.4.x86_64.rpm          | 9.8 MB     15:12\r\n--------------------------------------------------------------------------------\r\nTotal                                            11 kB\/s |  15 MB     22:20\r\nRunning rpm_check_debug\r\nRunning Transaction Test\r\nFinished Transaction Test\r\nTransaction Test Succeeded\r\nRunning Transaction\r\n  Updating       : mysql                                                    1\/4\r\n  Installing     : perl-DBD-MySQL                                           2\/4\r\n  Installing     : mysql-server                                             3\/4\r\n  Cleanup        : mysql                                                    4\/4\r\n\r\nInstalled:\r\n  mysql-server.x86_64 0:5.0.77-4.el5_5.4\r\n\r\nDependency Installed:\r\n  perl-DBD-MySQL.x86_64 0:3.0007-2.el5\r\n\r\nDependency Updated:\r\n  mysql.x86_64 0:5.0.77-4.el5_5.4\r\n\r\nComplete!\r\n<\/pre>\n<h2>Step 4: Start and Enable MySQL Server<\/h2>\n<p>After the installation is complete, start the MySQL server and enable it to start automatically on system boot:<\/p>\n<pre>\r\nsudo systemctl start mysqld\r\nsudo systemctl enable mysqld\r\n<\/pre>\n<h2>Step 5: Secure MySQL Installation<\/h2>\n<p>Run the mysql_secure_installation script to perform basic security settings such as setting a root password, removing anonymous users, disabling remote root login, and removing the test database:<\/p>\n<pre>\r\nsudo mysql_secure_installation\r\n<\/pre>\n<p>Follow the prompts and answer the questions accordingly to complete the MySQL security setup.<\/p>\n<h2>Programs Mentioned:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">MySQL<\/span> &#8211; An open-source relational database management system used for managing databases and organizing data.<\/li>\n<li><span class=\"fw-bold\">YUM (Yellowdog Updater, Modified)<\/span> &#8211; A package manager used by CentOS, RHEL, and other Linux distributions to install, update, and manage software packages.<\/li>\n<li><span class=\"fw-bold\">mysql_secure_installation<\/span> &#8211; A script that performs basic security settings for MySQL, including setting a root password, removing anonymous users, and deleting the test database.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>You have successfully installed MySQL on your Linux system using YUM. You can now start using MySQL to manage your databases and organize data for your applications or websites. Remember to follow best practices for database security and maintain regular backups of your data.<\/p>\n<p>If you have any questions, comments, or suggestions for improvements, please feel free to share your thoughts. Your feedback helps us provide the most accurate and useful information possible.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL is a widely used, open-source relational database management system. It is an essential component for many applications and websites. This guide will walk you through the process of installing&#8230;<\/p>\n","protected":false},"author":6,"featured_media":343,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1008],"tags":[1536,1585],"class_list":["post-336","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","tag-linux","tag-mysql"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/336","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=336"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/336\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/343"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}