{"id":6740,"date":"2017-06-03T17:13:24","date_gmt":"2017-06-03T09:13:24","guid":{"rendered":"http:\/\/rmohan.com\/?p=6740"},"modified":"2017-06-03T17:13:24","modified_gmt":"2017-06-03T09:13:24","slug":"centos-7-2-install-the-mysql-5-7-18-with-the-rpm-package","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6740","title":{"rendered":"CentOS 7.2 install the MySQL 5.7.18 with the rpm package"},"content":{"rendered":"<p>Description<\/p>\n<p>This article uses MySQL-5.7.18. The operating system is 64-bit CentOS Linux release 7.2.1511 (Core), installed as a desktop.<\/p>\n<p>Uninstall MariaDB<\/p>\n<p>CentOS7 defaults to installing MariaDB instead of MySQL, and the yum server also removes the MySQL-related packages. Because MariaDB and MySQL may conflict, so first uninstall MariaDB.<\/p>\n<p>View the installed DebianDB related rpm package.<\/p>\n<p>rpm -qa | grep mariadb<br \/>\nView the installed MariaDB-related yum package, package name to be rpmjudged by the results of the order.<\/p>\n<p>yum list mariadb-libs<br \/>\nRemove the installed MariaDB-related yum package, the package name to yum listjudge the results according to the order. This step requires root privileges.<\/p>\n<p>yum remove mariadb-libs<br \/>\nDownload the MySQL rpm package<\/p>\n<p>As the software package is large, you can first use other ways (such as Thunder) to download. Using rpm, but also can not be installed under the conditions of the network &#8211; this is yum can not do. To install other versions of MySQL, please go to the official website to search the corresponding rpm download link.<\/p>\n<p>wget https:\/\/cdn.mysql.com\/\/Downloads\/MySQL-5.7\/mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar<br \/>\nUse the rpm package to install MySQL<\/p>\n<p>The following steps require root privileges. And because of the dependencies between the packages, the rpmcommands must be executed in sequence.<\/p>\n<p>mkdir mysql-5.7.18<br \/>\ntar -xv -f mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar -C mysql-5.7.18<br \/>\ncd mysql-5.7.18\/<br \/>\nrpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm<br \/>\nrpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm<br \/>\nrpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm<br \/>\nrpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm<br \/>\nAfter the installation is successful, you can also delete the installation files and temporary files.<\/p>\n<p>cd ..<br \/>\nrm -rf mysql-5.7.18<br \/>\nrm mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar<br \/>\nModify the MySQL initial password<\/p>\n<p>The following steps require root privileges.<\/p>\n<p>Since the beginning does not know the password, first modify the configuration file \/etc\/my.cnfso that MySQL skip the login when the permissions check. Add a line<\/p>\n<p>skip-grant-tables<br \/>\nRestart MySQL.<\/p>\n<p>service mysqld restart<br \/>\nFree password to log in to MySQL.<\/p>\n<p>mysql<br \/>\nIn the mysql client to execute the following order, modify the root password.<\/p>\n<p>use mysql;<br \/>\nUPDATE user SET authentication_string = password(&#8216;your-password&#8217;) WHERE host = &#8216;localhost&#8217; AND user = &#8216;root&#8217;;<br \/>\nquit;<br \/>\nModify the configuration file to \/etc\/my.cnfdelete the previous line skip-grant-tablesand restart MySQL. This step is very important and failure to perform can lead to serious security problems.<br \/>\nLog in using the password you just set.<\/p>\n<p>mysql -u root -p<br \/>\nMySQL will force the need to re-modify the password, and can not be a simple rule password.<\/p>\n<p>ALTER USER root@localhost IDENTIFIED BY &#8216;your-new-password&#8217;;<br \/>\nSteps may be a little trouble, have not yet thought of other ways, first use this.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description<\/p>\n<p>This article uses MySQL-5.7.18. The operating system is 64-bit CentOS Linux release 7.2.1511 (Core), installed as a desktop.<\/p>\n<p>Uninstall MariaDB<\/p>\n<p>CentOS7 defaults to installing MariaDB instead of MySQL, and the yum server also removes the MySQL-related packages. Because MariaDB and MySQL may conflict, so first uninstall MariaDB.<\/p>\n<p>View the installed DebianDB related rpm package.<\/p>\n<p> [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6740"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6740"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6740\/revisions"}],"predecessor-version":[{"id":6741,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6740\/revisions\/6741"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}