{"id":1068,"date":"2017-11-04T12:00:00","date_gmt":"2017-11-04T03:00:00","guid":{"rendered":"https:\/\/hi3103.net\/notes\/?p=1068"},"modified":"2022-07-09T23:33:53","modified_gmt":"2022-07-09T14:33:53","slug":"%e3%81%95%e3%81%8f%e3%82%89vps%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e5%88%9d%e6%9c%9f%e8%a8%ad%e5%ae%9a-mysql-server%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab","status":"publish","type":"post","link":"https:\/\/hi3103.net\/notes\/web\/1068","title":{"rendered":"\u3055\u304f\u3089VPS\u30b5\u30fc\u30d0\u30fc\u521d\u671f\u8a2d\u5b9a &#8211; MySQL Server\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb"},"content":{"rendered":"<h4>\u53c2\u8003URL<\/h4>\n<ul>\n<li>\n<p><a href=\"https:\/\/knowledge.sakura.ad.jp\/9006\/\">\u30cd\u30b3\u3067\u3082\u308f\u304b\u308b\uff01\u3055\u304f\u3089\u306eVPS\u8b1b\u5ea7 \uff5e\u7b2c\u56db\u56de\u300cphp\u3068MariaDB\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3088\u3046\u300d | \u3055\u304f\u3089\u306e\u30ca\u30ec\u30c3\u30b8<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/weblabo.oscasierra.net\/installing-mysql57-centos7-yum\/\">MySQL 5.7 \u3092 CentOS 7 \u306b yum \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u624b\u9806<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/qiita.com\/ksugawara61\/items\/336ffab798e05cae4afc\">CentOS7.1\u306bMySQL 5.7\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb &#8211; Qiita<\/a><\/p>\n<p><!--more--><\/p>\n<h4>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9(MySQL)\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h4>\n<h5>MySQL\u306e\u516c\u5f0fyum\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u8ffd\u52a0\u3059\u308b<\/h5>\n<pre><code class=\"language-sh\"># yum localinstall https:\/\/dev.mysql.com\/get\/mysql57-community-release-el7-11.noarch.rpm<\/code><\/pre>\n<\/li>\n<li>\n<p>\u4e0a\u8a18URL\u306f<a href=\"https:\/\/dev.mysql.com\/downloads\/repo\/yum\/\">MySQL :: Download MySQL Yum Repository<\/a>\u306e\u4ee5\u4e0b\u306e\u5834\u6240\u304b\u3089\u9077\u79fb\u3057\u305f\u30da\u30fc\u30b8\u306b\u3042\u308b<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hi3103.net\/notes\/img\/uploads\/2017\/11\/20171104223141.png\" alt=\"MySQL\u306e\u516c\u5f0fyum\u30ea\u30dd\u30b8\u30c8\u30ea\u304c\u8a18\u8ff0\u3057\u3066\u3042\u308b\u5834\u6240\u306e\u8aac\u660e\u753b\u50cf\" width=\"800\" height=\"581\"  \/>\n<\/li>\n<\/ul>\n<h5>MySQL Community Server \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h5>\n<ul>\n<li>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u53ef\u80fd\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u304b\u3069\u3046\u304b\u60c5\u5831\u3092\u78ba\u8a8d<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># yum info mysql-community-server<\/code><\/pre>\n<pre><code>\uff08\u7565\uff09\nAvailable Packages\nName        : mysql-community-server\nArch        : x86_64\nVersion     : 5.7.20\nRelease     : 1.el7\nSize        : 164 M\nRepo        : mysql57-community\/x86_64\nSummary     : A very fast and reliable SQL database server\nURL         : http:\/\/www.mysql.com\/\n\uff08\u7565\uff09<\/code><\/pre>\n<ul>\n<li>yum list\u3067\u3082\u30d2\u30c3\u30c8\u3059\u308b<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># yum list available | grep mysql-community-server\nmysql-community-server.x86_64            5.7.20-1.el7                    mysql57-community<\/code><\/pre>\n<ul>\n<li>yum install \u3067 mysql-community-server \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># yum -y install mysql-community-server<\/code><\/pre>\n<pre><code>Options:\n  -y, --assumeyes       answer yes for all questions<\/code><\/pre>\n<h4>MySQL Server\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u78ba\u8a8d\u3059\u308b<\/h4>\n<pre><code class=\"language-sh\"># mysqld --version\nmysqld  Ver 5.7.20 for Linux on x86_64 (MySQL Community Server (GPL))<\/code><\/pre>\n<h4>MySQL Server\u3092\u8d77\u52d5\u3059\u308b<\/h4>\n<ul>\n<li>Apache\u3068\u540c\u3058\u30b3\u30de\u30f3\u30c9\u3002<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># systemctl start mysqld.service<\/code><\/pre>\n<h4>\u30b5\u30fc\u30d0\u30fc\u8d77\u52d5\u6642\u306bMySQL Server\u3082\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u3059\u308b<\/h4>\n<ul>\n<li>Apache\u3067\u3084\u3063\u305f\u306e\u3068\u540c\u3058\u30b3\u30de\u30f3\u30c9\u3002<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># systemctl enable mysqld.service<\/code><\/pre>\n<ul>\n<li>\u30ea\u30b9\u30c8\u3067\u78ba\u8a8d\n<ul>\n<li>enabled\u306b\u306a\u3063\u3066\u3044\u308c\u3070OK<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># systemctl list-unit-files -t service | grep mysqld.service\nmysqld.service                                enabled<\/code><\/pre>\n<h4>MySQL\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a\u3092\u884c\u3046<\/h4>\n<h5>\u521d\u56de\u8d77\u52d5\u6642\u306b\u751f\u6210\u3055\u308c\u308b\u521d\u671f\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u78ba\u8a8d\u3059\u308b<\/h5>\n<pre><code class=\"language-sh\"># cat \/var\/log\/mysqld.log | grep 'temporary password'\n2017-11-04T13:43:42.769281Z 1 [Note] A temporary password is generated for root@localhost: {\u521d\u671f\u30d1\u30b9\u30ef\u30fc\u30c9}<\/code><\/pre>\n<h5>mysql_secure_installation\u3092\u5b9f\u884c<\/h5>\n<pre><code class=\"language-sh\"># mysql_secure_installation<\/code><\/pre>\n<pre><code>Securing 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: <\/code><\/pre>\n<pre><code>The 'validate_password' plugin is installed on the server.\nThe subsequent steps will run with the existing configuration\nof the plugin.\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) : y<\/code><\/pre>\n<pre><code>New password: \n\nRe-enter new password: \n\nEstimated strength of the password: 100 \nDo you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y<\/code><\/pre>\n<pre><code>By 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.<\/code><\/pre>\n<pre><code>Normally, 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.<\/code><\/pre>\n<pre><code>By 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\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.<\/code><\/pre>\n<pre><code>Reloading 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.<\/code><\/pre>\n<pre><code>All done! <\/code><\/pre>\n<h5>\u8a2d\u5b9a\u3057\u305f\u30d1\u30b9\u30ef\u30fc\u30c9\u3067MySQL\u306broot\u3067\u30ed\u30b0\u30a4\u30f3<\/h5>\n<pre><code class=\"language-sh\"># mysql -u root -p\nEnter password: {\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u5165\u529b}<\/code><\/pre>\n<ul>\n<li>\u6210\u529f\u3059\u308b\u3068\u4e0b\u8a18\u304c\u8868\u793a\u3055\u308c\u308b<\/li>\n<\/ul>\n<pre><code>Welcome to the MySQL monitor.  Commands end with ; or g.\nYour MySQL connection id is 8\nServer version: 5.7.20 MySQL Community Server (GPL)\n\nCopyright (c) 2000, 2017, Oracle and\/or its affiliates. All rights reserved.\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.<\/code><\/pre>\n<ul>\n<li>\u305f\u3081\u3057\u306b\u30b3\u30de\u30f3\u30c9\u6253\u3063\u3066\u307f\u308b<\/li>\n<\/ul>\n<pre><code>mysql&gt; show databases;\n1. --------------------+\n| Database           |\n1. --------------------+\n| information_schema |\n| mysql              |\n| performance_schema |\n| sys                |\n1. --------------------+\n4 rows in set (0.00 sec)<\/code><\/pre>\n<ul>\n<li>\u51fa\u308b\u3068\u304d\u306fexit<\/li>\n<\/ul>\n<pre><code>mysql&gt; exit\nBye<\/code><\/pre>\n<h4>\u88dc\u8db3\uff1adefault_password_lifetime\u306b\u3064\u3044\u3066<\/h4>\n<ul>\n<li>\u53c2\u8003\u306b\u3057\u305f\u30a8\u30f3\u30c8\u30ea\u30fc\u306b\u306f\u300c\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u6709\u52b9\u671f\u9650\u30920\u306b\u3057\u3066\u304a\u304f\u300d\uff1d\u300c\/etc\/my.cnf \u306b default_password_lifetime = 0 \u3092\u8ffd\u8a18\u3059\u308b\u300d\u65e8\u304c\u66f8\u304b\u308c\u3066\u3044\u305f\u304c\u3001\u30d0\u30fc\u30b8\u30e7\u30f35.7.11\u304b\u3089\u306f0\u304c\u30c7\u30d5\u30a9\u30eb\u30c8\u306b\u306a\u3063\u3066\u308b\u3089\u3057\u3044\u3002\n<ul>\n<li>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30d0\u30fc\u30b8\u30e7\u30f3\u306f5.7.20\u306a\u306e\u3067\u3001\u306a\u306b\u3082\u305b\u305a\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<blockquote>\n<p>https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/server-system-variables.html#sysvar_default_password_lifetime:title=MySQL :: MySQL 5.7 Reference Manual :: 5.1.5 Server System Variables&gt;<br \/>\nThe default default_password_lifetime value is 0, which disables automatic password expiration.<\/p>\n<\/blockquote>\n<h4>\u8ffd\u8a18\uff1aMySQL Server\u3092\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b<\/h4>\n<ul>\n<li>mysql\u95a2\u4fc2\u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u78ba\u8a8d<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># yum list installed | grep mysql<\/code><\/pre>\n<ul>\n<li>\u8868\u793a\u3055\u308c\u305f\u3082\u306e\u3092\u524a\u9664\u3057\u3066\u3044\u304f\u3002\n<ul>\n<li>\u4f9d\u5b58\u6027\u306e\u3042\u308b\u4e0b\u8a18\u30d1\u30c3\u30b1\u30fc\u30b8\u3082\u524a\u9664\u3055\u308c\u305f\u3002\n<ul>\n<li>fail2ban<\/li>\n<li>fail2ban-sendmail<\/li>\n<li>postfix<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre><code class=\"language-sh\"># yum erase mysql-community-*<\/code><\/pre>\n<pre><code>&lt;!--more--&gt;\n Package                            Arch          Version                 Repository                 Size\n&lt;!--more--&gt;\nRemoving:\n mysql-community-client             x86_64        5.7.20-1.el7            @mysql57-community        106 M\n mysql-community-common             x86_64        5.7.20-1.el7            @mysql57-community        2.5 M\n mysql-community-libs               x86_64        5.7.20-1.el7            @mysql57-community        9.4 M\n mysql-community-libs-compat        x86_64        5.7.20-1.el7            @mysql57-community        9.2 M\n mysql-community-server             x86_64        5.7.20-1.el7            @mysql57-community        738 M\nRemoving for dependencies:\n fail2ban                           noarch        0.9.7-1.el7             @epel                     0.0  \n fail2ban-sendmail                  noarch        0.9.7-1.el7             @epel                      11 k\n postfix                            x86_64        2:2.10.1-6.el7          @base                      12 M<\/code><\/pre>\n<pre><code class=\"language-sh\"># yum erase mysql57-community-release<\/code><\/pre>\n<pre><code>&lt;!--more--&gt;\n Package                               Arch               Version             Repository             Size\n&lt;!--more--&gt;\nRemoving:\n mysql57-community-release             noarch             el7-11              installed              31 k<\/code><\/pre>\n<ul>\n<li>\/var\/lib \u306b\u3042\u3063\u305fmysql\u95a2\u9023\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3082\u524a\u9664\u3055\u308c\u305f\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u53c2\u8003URL \u30cd\u30b3\u3067\u3082\u308f\u304b\u308b\uff01\u3055\u304f\u3089\u306eVPS\u8b1b\u5ea7 \uff5e\u7b2c\u56db\u56de\u300cphp\u3068MariaDB\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3088\u3046\u300d | \u3055\u304f\u3089\u306e\u30ca\u30ec\u30c3\u30b8 MySQL 5.7 \u3092 CentOS 7 \u306b yum \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u624b\u9806 CentOS7.1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[53],"tags":[51,26,50,48],"class_list":["post-1068","post","type-post","status-publish","format-standard","hentry","category-web","tag-apache","tag-centos7","tag-mysql","tag-server"],"_links":{"self":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts\/1068","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/comments?post=1068"}],"version-history":[{"count":0,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/posts\/1068\/revisions"}],"wp:attachment":[{"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/media?parent=1068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/categories?post=1068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hi3103.net\/notes\/wp-json\/wp\/v2\/tags?post=1068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}