{"id":11134,"date":"2023-02-13T16:34:33","date_gmt":"2023-02-13T07:34:33","guid":{"rendered":"https:\/\/www.stuffy.site\/computers\/?p=11134"},"modified":"2023-02-13T16:59:13","modified_gmt":"2023-02-13T07:59:13","slug":"mariadb%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e5%88%9d%e6%9c%9f%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/www.stuffy.site\/computers\/archives\/11134","title":{"rendered":"MariaDB\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u521d\u671f\u8a2d\u5b9a"},"content":{"rendered":"\n<p>Rocky Linux\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u624b\u7fd2\u3044\u3067\u65b0\u898fDB\u30b5\u30fc\u30d0\u30fc\u306bMariaDB10.10\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3001\u521d\u671f\u8a2d\u5b9a\u3092\u3057\u305f\u306e\u3067\u30e1\u30e2\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">\u6982\u8981<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#at-the-beginning\">\u306f\u3058\u3081\u306b<\/a><\/li>\n\n\n\n<li><a href=\"#remove-old-version\">\u65e7\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u524a\u9664<\/a><\/li>\n\n\n\n<li><a href=\"#get-and-save-repository\">\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u53d6\u5f97\u30fb\u4fdd\u5b58<\/a><\/li>\n\n\n\n<li><a href=\"#install-mariadb\">MariaDB\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a><\/li>\n\n\n\n<li><a href=\"#systemctl-start-mariadb\">MariaDB\u306e\u8d77\u52d5<\/a><\/li>\n\n\n\n<li><a href=\"#mariadb-installation-settings\">MariaDB\u521d\u671f\u8a2d\u5b9a<\/a><\/li>\n\n\n\n<li><a href=\"#change-charactor-set-utf8mb4\">server.cnf \u304b\u3089\u6587\u5b57\u30bb\u30c3\u30c8\u3092utf8mb4 \u306b\u5909\u66f4\u3059\u308b<\/a><\/li>\n\n\n\n<li><a href=\"#check-charactor-set\">MariaDB\u3092\u518d\u8d77\u52d5\u3057\u3066\u6587\u5b57\u30bb\u30c3\u30c8\u3092\u78ba\u8a8d\u3059\u308b<\/a><\/li>\n\n\n\n<li><a href=\"#to-the-end\">\u304a\u308f\u308a\u306b<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"at-the-beginning\">\u306f\u3058\u3081\u306b<\/h2>\n\n\n\n<p>MySQL\u4e92\u63db\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2 MariaDB\u3092Rocky Linux 8\u65b0\u898fVM\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3001\u521d\u671f\u8a2d\u5b9a\u3057\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"remove-old-version\">\u65e7\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u524a\u9664<\/h2>\n\n\n\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u306b\u3042\u305f\u3063\u3066\u6700\u521d\u306b\u3001\u300cdnf list\u300d\u30b3\u30de\u30f3\u30c9\u3067\u65e7\u30d0\u30fc\u30b8\u30e7\u30f3\u306emariadb* \u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u8abf\u3079\u3066\u6b8b\u3063\u3066\u3044\u308c\u3070\u3042\u3089\u304b\u3058\u3081\u524a\u9664\u3057\u307e\u3059\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># dnf list installed | grep 'mariadb'<br><br># dnf remove mariadb*<\/span><\/pre>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"get-and-save-repository\">\u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u53d6\u5f97\u30fb\u4fdd\u5b58<\/h2>\n\n\n\n<p>MariaDB-server MariaDB-devel MariaDB-client \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u305f\u3081<a href=\"https:\/\/mariadb.org\/download\/?t=repo-config\">MariaDB.org<\/a> \u30b5\u30a4\u30c8\u304b\u3089RHEL8\u306eMariaDB\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n\n\n<p style=\"text-align: center;\"><a href=\"https:\/\/mariadb.org\/download\/?t=repo-config\">https:\/\/mariadb.org\/download\/?t=repo-config<\/a><\/p>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><a href=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/02\/mariadb_org-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1022\" height=\"1024\" src=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/02\/mariadb_org-1-1022x1024.png\" alt=\"\" class=\"wp-image-11136\" srcset=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/02\/mariadb_org-1-1022x1024.png 1022w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/02\/mariadb_org-1-300x300.png 300w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/02\/mariadb_org-1-150x150.png 150w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/02\/mariadb_org-1-768x769.png 768w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/02\/mariadb_org-1.png 1059w\" sizes=\"auto, (max-width: 1022px) 100vw, 1022px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<p>vi \/etc\/yum.repos.d\/MariaDB.repo \u3092\u65b0\u898f\u4f5c\u6210\u3057\u3066\u30ea\u30dd\u30b8\u30c8\u30ea\u3092\u30b3\u30d4\u30fc\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># vi \/etc\/yum.repos.d\/MariaDB.repo<\/span><\/pre>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/02\/mariadb_repo.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/02\/mariadb_repo.png\" alt=\"\" class=\"wp-image-11138\" width=\"494\" height=\"365\" srcset=\"https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/02\/mariadb_repo.png 659w, https:\/\/www.stuffy.site\/computers\/wp-content\/uploads\/2023\/02\/mariadb_repo-300x221.png 300w\" sizes=\"auto, (max-width: 494px) 100vw, 494px\" \/><\/a><\/figure>\n<\/div>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"install-mariadb\">MariaDB\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n\n\n\n<p>\u7d9a\u3044\u3066MariaDB-server MariaDB-client \u3092\u300c dnf \u300d\u30b3\u30de\u30f3\u30c9\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># dnf install MariaDB-server MariaDB-client MariaDB-devel<\/span><\/pre>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"systemctl-start-mariadb\">MariaDB\u306e\u8d77\u52d5<\/h2>\n\n\n\n<p>\u554f\u984c\u304c\u306a\u3051\u308c\u3070MariaDB\u304c\u8d77\u52d5\u3057\u307e\u3059\u3002\u3064\u3044\u3067\u306b\u81ea\u52d5\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># systemctl start mariadb\n# systemctl enable mariadb<\/span><\/pre>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"mariadb-installation-settings\">MariaDB\u521d\u671f\u8a2d\u5b9a<\/h2>\n\n\n\n<p>\u521d\u671f\u8a2d\u5b9a\u306f \u300c mariadb-secure-installation \u300d\u30b3\u30de\u30f3\u30c9\u3067\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># mariadb-secure-installation<br><\/span>\nNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB\n      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!\n\nIn order to log into MariaDB to secure it, we'll need the current\npassword for the root user. If you've just installed MariaDB, and\nhaven't set the root password yet, you should just press enter here.\n\nEnter current password for root (enter for none):<span style=\"color: #0000ff;\">[\u521d\u56de\u306fEnter\u30ad\u30fc]<\/span>\nOK, successfully used password, moving on...\n\nSetting the root password or using the unix_socket ensures that nobody\ncan log into the MariaDB root user without the proper authorisation.\n\nYou already have your root account protected, so you can safely answer 'n'.\n\nSwitch to unix_socket authentication [Y\/n]<span style=\"color: #0000ff;\"> n<\/span>\n ... skipping.\n\nBy default, a MariaDB installation has an anonymous user, allowing anyone\nto log into MariaDB without having to have a user account created for\nthem.  This is intended only for testing, and to make the installation\ngo a bit smoother.  You should remove them before moving into a\nproduction environment.\n\nRemove anonymous users? [Y\/n] <span style=\"color: #0000ff;\">y<\/span>\n ... Success!\n\nNormally, root should only be allowed to connect from 'localhost'.  This\nensures that someone cannot guess at the root password from the network.\n\nDisallow root login remotely? [Y\/n] <span style=\"color: #0000ff;\">y<\/span>\n ... Success!\n\nBy default, MariaDB comes with a database named 'test' that anyone can\naccess.  This is also intended only for testing, and should be removed\nbefore moving into a production environment.\n\nRemove test database and access to it? [Y\/n] <span style=\"color: #0000ff;\">y<\/span>\n - Dropping test database...\n ... Success!\n - Removing privileges on test database...\n ... Success!\n\nReloading the privilege tables will ensure that all changes made so far\nwill take effect immediately.\n\nReload privilege tables now? [Y\/n] <span style=\"color: #0000ff;\">y<\/span>\n ... Success!\n\nCleaning up...\n\nAll done!  If you've completed all of the above steps, your MariaDB\ninstallation should now be secure.\n\nThanks for using MariaDB!<\/pre>\n\n\n<h2 class=\"wp-block-heading\" id=\"change-charactor-set-utf8mb4\">server.cnf \u304b\u3089\u6587\u5b57\u30bb\u30c3\u30c8\u3092utf8mb4 \u306b\u5909\u66f4\u3059\u308b<\/h2>\n\n\n\n<p>\u65e5\u672c\u8a9e\u570f\u306e\u5834\u5408\u306e\u6700\u4f4e\u9650\u306e\u6587\u5b57\u30bb\u30c3\u30c8\u306e\u5909\u66f4\u3092 server.cnf \u304b\u3089\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># cp -p \/etc\/my.cnf.d\/server.cnf \/etc\/my.cnf.d\/mariadb-server.cnf.org<br><br># vi \/etc\/my.cnf.d\/server.cnf<br><\/span>\n# This group is only read by MariaDB servers, not by MySQL.\n# If you use the same .cnf file for MySQL and MariaDB,\n# you can put MariaDB-only options here\n[mariadb]<br>\u2193\u2193\u2193\u2193\uff08\u3053\u3053\u304b\u3089\u8ffd\u8a18\uff09\u2193\u2193\u2193\u2193\n<span style=\"color: #0000ff;\">character-set-server = utf8mb4\n\n[client-mariadb]\ndefault-character-set = utf8mb4<\/span><\/pre>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"check-charactor-set\">MariaDB\u3092\u518d\u8d77\u52d5\u3057\u3066\u6587\u5b57\u30bb\u30c3\u30c8\u3092\u78ba\u8a8d\u3059\u308b<\/h2>\n\n\n\n<p>\u554f\u984c\u304c\u306a\u3051\u308c\u3070MariaDB\u518d\u8d77\u52d5\u3057\u3066\u300c mysql -u root -p \u300d\u30b3\u30de\u30f3\u30c9\u3067\u5148\u307b\u3069\u8a2d\u5b9a\u3057\u305f\u30d1\u30b9\u30ef\u30fc\u30c9\u304b\u3089\u30ed\u30b0\u30a4\u30f3\u3001\u6587\u5b57\u30bb\u30c3\u30c8\u3092\u78ba\u8a8d\u3057\u307e\u3059\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\">#  systemctl restart mariadb<br><\/span><\/pre>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<p>MariaDB\u306b\u30ed\u30b0\u30a4\u30f3<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># mysql -u root -p<br \/><br \/>MariaDB [(none)]&gt; show variables like \"chara%\";<br \/><\/span><\/pre>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<p>\u6587\u5b57\u30bb\u30c3\u30c8\u3092\u78ba\u8a8d<\/p>\n\n\n<pre style=\"background-color: #000000; color: #ffffff;\">Enter password:\n<span style=\"color: #ffff00;\">Welcome to the MariaDB monitor.  Commands end with ; or \\g.\nYour MariaDB connection id is 3\nServer version: 10.10.3-MariaDB MariaDB Server\n\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.<\/span>\n\nMariaDB [(none)]&gt; show variables like \"chara%\";\n+--------------------------+----------------------------+\n| Variable_name            | Value                      |\n+--------------------------+----------------------------+\n| character_set_client     | utf8mb4                    |\n| character_set_connection | utf8mb4                    |\n| character_set_database   | utf8mb4                    |\n| character_set_filesystem | binary                     |\n| character_set_results    | utf8mb4                    |\n| character_set_server     | utf8mb4                    |\n| character_set_system     | utf8mb3                    |\n| character_sets_dir       | \/usr\/share\/mysql\/charsets\/ |\n+--------------------------+----------------------------+\n<span style=\"color: #ffff00;\">8 rows in set (0.001 sec)<\/span>\n\nMariaDB [(none)]&gt; \\q\n<span style=\"color: #ffff00;\">Bye<\/span><\/pre>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<p>\u300c <span style=\"font-family:Arial\">\\q <\/span>\u300d\u3067\u30ed\u30b0\u30a2\u30a6\u30c8\u3057\u3066\u4f5c\u696d\u7d42\u4e86\u3067\u3059\u3002\u304a\u75b2\u308c\u69d8\u3067\u3057\u305f\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\">\\q<\/span><\/pre>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<p>character_set_system \u306eutf8mb3 \u306f utf8 \u306e\u30a8\u30a4\u30ea\u30a2\u30b9\u3068\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u9014\u4e2d\u3001pid\u30d5\u30a1\u30a4\u30eb\u304c\u306a\u3044\u3068\u304b\u30a8\u30e9\u30fc\u304c\u51fa\u3066\u518d\u8d77\u52d5\u3057\u3066\u3082\u300c\u3082\u3046\u7121\u7406\uff01\u300d\u3068\u3044\u3046\u5834\u5408\u306f\u6700\u60aa\u3001\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u30c7\u30fc\u30bf\u30c7\u30a3\u30ec\u30af\u30c8\u30ea \/var\/lib\/mysql \u3092\u524a\u9664\u3001\u6700\u521d\u304b\u3089\u518d\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u65b9\u304c\u30b9\u30c3\u30ad\u30ea\u3057\u307e\u3059\u3002<\/p>\n\n\n<pre><span style=\"font-size: 14pt; color: #0000ff;\"># rm -rf \/var\/lib\/mysql<\/span><\/pre>\n\n\n<p class=\"has-text-align-right\">.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"to-the-end\">\u304a\u308f\u308a\u306b<\/h2>\n\n\n\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306f\u69cb\u9020\u3084\u30b3\u30de\u30f3\u30c9\u304c\u5965\u6df1\u304fMySQL\u3068\u306e\u4e92\u63db\u6027\u306a\u3069\u6ce8\u610f\u3059\u3079\u304d\u3053\u3068\u3082\u3042\u308a\u307e\u3059\u304c\u7fd2\u3046\u3088\u308a\u6163\u308c\u308d\u3067\u3084\u308a\u305f\u3044\u3053\u3068\u304c\u3067\u304d\u3066\u3044\u308b\u306e\u3067\u958b\u767a\u8005\u306e\u65b9\u3005\u306b\u611f\u8b1d\u3067\u3059\u3002\u6700\u5f8c\u307e\u3067\u304a\u8aad\u307f\u4e0b\u3055\u308a\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rocky Linux\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u624b\u7fd2\u3044\u3067\u65b0\u898fDB\u30b5\u30fc\u30d0\u30fc\u306bMariaDB10.10\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3001\u521d\u671f\u8a2d\u5b9a\u3092\u3057\u305f\u306e\u3067\u30e1\u30e2\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[92,91],"tags":[],"class_list":["post-11134","post","type-post","status-publish","format-standard","hentry","category-mariadb","category-rocky-linux"],"_links":{"self":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/11134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/comments?post=11134"}],"version-history":[{"count":16,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/11134\/revisions"}],"predecessor-version":[{"id":11154,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/11134\/revisions\/11154"}],"wp:attachment":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/media?parent=11134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/categories?post=11134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/tags?post=11134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}