{"id":1327,"date":"2016-12-28T12:27:52","date_gmt":"2016-12-28T12:27:52","guid":{"rendered":"http:\/\/www.fastwebhost.in\/blog\/?p=1327"},"modified":"2019-01-22T12:00:04","modified_gmt":"2019-01-22T12:00:04","slug":"mysql-installation-on-centos-server","status":"publish","type":"post","link":"https:\/\/www.fastwebhost.in\/blog\/mysql-installation-on-centos-server\/","title":{"rendered":"Installing MySQL on CentOS Server"},"content":{"rendered":"<h5>INTRODUCTION<\/h5>\n<p>MySQL is an open-source database management system, commonly installed as part of the popular LAMP (Linux, Apache, MySQL, PHP\/Python\/Perl) stack. It uses a relational database and SQL (Structured Query Language) to manage its data. Let&#8217;s see Installing MySQL on CentOS server.<\/p>\n<h6>Installing MySQL 5.6<\/h6>\n<p>To install MySQL 5.6 this way, update the package index on your server with below command<\/p>\n<p>yum update<\/p>\n<p>Now download the Yum Repo package of MySQL Server 5.6<\/p>\n<p><span style=\"box-sizing: inherit;\">wget http<\/span><span style=\"box-sizing: inherit;\">:<\/span><span style=\"box-sizing: inherit;\">\/\/<a href=\"http:\/\/repo.mysql.com\/mysql-community-release-el6-5.noarch.rpm\" rel=\"nofollow\"><span>repo<\/span><span>.<\/span><span>mysql<\/span><span>.<\/span><span>com<\/span><span>\/<\/span><span>mysql<\/span><span>&#8211;<\/span><span>community<\/span><span>&#8211;<\/span><span>release<\/span><span>&#8211;<\/span><span>el6<\/span><span>&#8211;<\/span><span>5<\/span><span>.<\/span><span>noarch<\/span><span>.<\/span><span>rpm<\/span><\/a><\/span><\/p>\n<p>Below rpm command helps you install the rpm package which was already downloaded in the above step.<\/p>\n<p><span style=\"box-sizing: inherit;\">rpm <\/span><span style=\"box-sizing: inherit;\">&#8211;<\/span><span style=\"box-sizing: inherit;\">ivh mysql<\/span><span style=\"box-sizing: inherit;\">&#8211;<\/span><span style=\"box-sizing: inherit;\">community<\/span><span style=\"box-sizing: inherit;\">&#8211;<\/span><span style=\"box-sizing: inherit;\">release<\/span><span style=\"box-sizing: inherit;\">&#8211;<\/span><span style=\"box-sizing: inherit;\">el6<\/span><span style=\"box-sizing: inherit;\">&#8211;<\/span><span style=\"box-sizing: inherit;\">5.noarch<\/span><span style=\"box-sizing: inherit;\">.<\/span><span style=\"box-sizing: inherit;\">rpm<\/span><span><img loading=\"lazy\" decoding=\"async\" alt=\"\" style=\"width: 696px\" src=\"\/\/www.fastwebhost.in\/blog\/wp-content\/uploads\/2016\/12\/oie_mb9viu7a0Kle.png\" height=\"159\" width=\"696\"><\/span><\/p>\n<p>After this installation completes, we can see two new yum repo&#8217;s &nbsp;related to MySQL.<\/p>\n<blockquote><p><span style=\"box-sizing: inherit;\">&nbsp;[<\/span><span style=\"box-sizing: inherit;\">root@localhost <\/span><span style=\"box-sizing: inherit;\">~]#<\/span><span style=\"box-sizing: inherit;\"> ls <\/span><span style=\"box-sizing: inherit;\">&#8211;<\/span><span style=\"box-sizing: inherit;\">1<\/span> <span style=\"box-sizing: inherit;\">\/<\/span><span style=\"box-sizing: inherit;\">etc<\/span><span style=\"box-sizing: inherit;\">\/<\/span><span style=\"box-sizing: inherit;\">yum<\/span><span style=\"box-sizing: inherit;\">.<\/span><span style=\"box-sizing: inherit;\">repos<\/span><span style=\"box-sizing: inherit;\">.<\/span><span style=\"box-sizing: inherit;\">d<\/span><span style=\"box-sizing: inherit;\">\/<\/span><span style=\"box-sizing: inherit;\">mysql<\/span><span style=\"box-sizing: inherit;\">&#8211;<\/span><span style=\"box-sizing: inherit;\">community<\/span><span style=\"box-sizing: inherit;\">*<\/span><span style=\"box-sizing: inherit;\">\/etc\/<\/span><span style=\"box-sizing: inherit;\">yum<\/span><span style=\"box-sizing: inherit;\">.<\/span><span style=\"box-sizing: inherit;\">repos<\/span><span style=\"box-sizing: inherit;\">.<\/span><span style=\"box-sizing: inherit;\">d<\/span><span style=\"box-sizing: inherit;\">\/<\/span><span style=\"box-sizing: inherit;\">mysql<\/span><span style=\"box-sizing: inherit;\">&#8211;<\/span><span style=\"box-sizing: inherit;\">community<\/span><span style=\"box-sizing: inherit;\">.<\/span><span style=\"box-sizing: inherit;\">repo<\/span><span style=\"box-sizing: inherit;\">\/<\/span><span style=\"box-sizing: inherit;\">etc<\/span><span style=\"box-sizing: inherit;\">\/<\/span><span style=\"box-sizing: inherit;\">yum<\/span><span style=\"box-sizing: inherit;\">.<\/span><span style=\"box-sizing: inherit;\">repos<\/span><span style=\"box-sizing: inherit;\">.<\/span><span style=\"box-sizing: inherit;\">d<\/span><span style=\"box-sizing: inherit;\">\/<\/span><span style=\"box-sizing: inherit;\">mysql<\/span><span style=\"box-sizing: inherit;\">&#8211;<\/span><span style=\"box-sizing: inherit;\">community<\/span><span style=\"box-sizing: inherit;\">&#8211;<\/span><span style=\"box-sizing: inherit;\">source<\/span><span style=\"box-sizing: inherit;\">.<\/span><span style=\"box-sizing: inherit;\">repo<\/span><\/p><\/blockquote>\n<p>Using the below yum command, now we can install MySQL Server 5.6 . All dependencies will be installed itself.<\/p>\n<p><span style=\"box-sizing: inherit;\">yum install mysql<\/span><span style=\"box-sizing: inherit;\">&#8211;<\/span><span style=\"box-sizing: inherit;\">server<\/span><span><img loading=\"lazy\" decoding=\"async\" title=\"mysql-install\" alt=\"mysql-install\" style=\"width: 590px;\" src=\"\/\/www.fastwebhost.in\/blog\/wp-content\/uploads\/2016\/12\/oie_asY9MskqylzU.png\" height=\"432\" width=\"590\"><\/span><\/p>\n<h6 style=\"margin-top: 30px !important;\">Installing MySQL 5.7<\/h6>\n<p>To install MYSQL 5.7, need to download &nbsp;yum repo package of MySQL Server 5.7. Using the URL you can download using <span>&#8220;wget&#8221;<\/span> command.<\/p>\n<p><span style=\"box-sizing: inherit;\">wget <a href=\"https:\/\/dev.mysql.com\/get\/mysql57-community-release-el7\" rel=\"nofollow\"><span>https<\/span><span>:\/\/<\/span><span>dev<\/span><span>.<\/span><span>mysql<\/span><span>.<\/span><span>com<\/span><span>\/<\/span><span>get<\/span><span>\/<\/span><span>mysql57<\/span><span>&#8211;<\/span><span>community<\/span><span>&#8211;<\/span><span>release<\/span><span>&#8211;<\/span><span>el7<\/span><\/a> 7.noarch.rpm<\/span><span style=\"box-sizing: inherit;\">yum localinstall mysql57-community-release-el7-7.noarch.rpm<\/span><\/p>\n<p>Now install MYSQL with the below command.<\/p>\n<p>yum install mysql-server<\/p>\n<h5>Configuring MySQL<\/h5>\n<p>This version of Oracle MySQL sets a root password by default. We need to retrieve it from the mysql logs.<\/p>\n<p>cat \/var\/log\/mysqld.log<\/p>\n<p>For MYSQL 5.7 default password is generated while downloading and installing MYSQL 5.7 repo.<\/p>\n<p>When it comes to MYSQL 5.6 we need to follow the below process using <span>&#8220;mysql_secure_installation&#8221;<\/span>.<\/p>\n<p style=\"margin-top: -30px !important;\">A temporary password is generated for root@localhost: *password*<\/p>\n<p>mysql_secure_installation<\/p>\n<p>You\u2019ll be prompt to enter your current password. Enter the root MySQL password set during installation.<\/p>\n<blockquote><p>Enter current password for root (enter for none):<\/p><\/blockquote>\n<p>Then, assuming you set a strong root password, go ahead and enter nat the following prompt:<\/p>\n<blockquote><p>Change the root password? [Y\/n] n<\/p><\/blockquote>\n<blockquote><p>Remove anonymous users, Y:<\/p><\/blockquote>\n<blockquote><p>Remove anonymous users? [Y\/n] Y<\/p><\/blockquote>\n<blockquote><p>Disallow root logins remotely, Y:<\/p><\/blockquote>\n<blockquote><p>Disallow root login remotely? [Y\/n] Y<\/p><\/blockquote>\n<blockquote><p>Remove test database and access to it, Y:<\/p><\/blockquote>\n<blockquote><p>Remove test database and access to it? [Y\/n] Y<\/p><\/blockquote>\n<blockquote><p>And reload privilege tables, Y:<\/p><\/blockquote>\n<blockquote><p>Reload privilege tables now? [Y\/n] Y<\/p><\/blockquote>\n<p>In another method, you can log into MySQL server database and reset the password in secure way.<\/p>\n<p>mysql -u root<\/p>\n<p>You will see mysql prompt like this <strong>mysql&gt;<\/strong> . Use the below given commands to reset root\u2019s password.<\/p>\n<p>mysql&gt; use mysql;mysql&gt; update user set password=PASSWORD(&#8220;GIVE-NEW-ROOT-PASSWORD&#8221;) where User=&#8217;root&#8217;;mysql&gt; flush privileges;mysql&gt; quit<span><img loading=\"lazy\" decoding=\"async\" title=\"mysql-commadline\" alt=\"mysql-commadline\" style=\"width: 696px;\" src=\"\/\/www.fastwebhost.in\/blog\/wp-content\/uploads\/2016\/12\/oie_CVlz5wz8HZEh.png\" height=\"203\" width=\"696\"><\/span><\/p>\n<p>Below are some MYSQL commands<\/p>\n<h6>To stop MySQL<\/h6>\n<p>service mysql stop<\/p>\n<h6>To start MySQL<\/h6>\n<p>service mysql start<\/p>\n<h6>To check the status of MySQL<\/h6>\n<p>service mysql status<\/p>\n<h6>To restart MySQL<\/h6>\n<p>Service mysqld restart<\/p>\n<h6>Sources to install MySQL<\/h6>\n<p>The below URL allows you to find MySQL repo to install it on your CentOs server.<\/p>\n<p><a href=\"http:\/\/dev.mysql.com\/doc\/mysql-apt-repo-quick-guide\/en\/\" target=\"_blank\">http:\/\/dev.mysql.com\/doc\/mysql-apt-repo-quick-guide\/en\/<\/a><\/p>\n<p>Hope this article helps you. You can comment below if you have any queries.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"http:\/\/0.gravatar.com\/avatar\/f6ac9722d69d863d88cf73514d182820?s=49&amp;d=mm&amp;r=g\" height=\"49\" width=\"49\">Author<a href=\"http:\/\/content.fastwebhost.in\/author\/shiva\/\">shiva<\/a>Posted on<a href=\"http:\/\/content.fastwebhost.in\/?p=450\" rel=\"bookmark\">December 28, 2016<\/a><a href=\"http:\/\/content.fastwebhost.in\/wp-admin\/post.php?post=450&amp;action=edit\">Edit<\/a><a href=\"http:\/\/content.fastwebhost.in\/wp-admin\/post.php?post=450&amp;action=edit\">&#8220;How to install MYSQL on CENTOS&#8221;<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>INTRODUCTION MySQL is an open-source database management system, commonly installed as part of the popular LAMP (Linux, Apache, MySQL, PHP\/Python\/Perl) stack. It uses a relational database and SQL (Structured Query Language) to manage its data. Let&#8217;s see Installing MySQL on CentOS server. Installing MySQL 5.6 To install MySQL 5.6 this way, update the package index [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":1330,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[22],"tags":[59,36,60,61],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/posts\/1327"}],"collection":[{"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/comments?post=1327"}],"version-history":[{"count":3,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/posts\/1327\/revisions"}],"predecessor-version":[{"id":4713,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/posts\/1327\/revisions\/4713"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/media\/1330"}],"wp:attachment":[{"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/media?parent=1327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/categories?post=1327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fastwebhost.in\/blog\/wp-json\/wp\/v2\/tags?post=1327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}