{"id":28365,"date":"2023-04-27T15:48:09","date_gmt":"2022-09-27T09:40:03","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/"},"modified":"2025-08-12T07:46:51","modified_gmt":"2025-08-11T23:46:51","slug":"ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/","title":{"rendered":"Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 &#8211; \u5b89\u88c5MariaDB"},"content":{"rendered":"<h2>\u5047\u8bbe,\u6761\u4ef6,\u57fa\u7840,\u8d77\u6b65\u70b9<\/h2>\n<p>\u5728\u5b89\u88c5WordPress\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5148\u5b89\u88c5MariaDB\u548cPHP\u3002<br \/>\n\u672c\u6587\u53ea\u8bb2\u8ff0\u4e86\u5982\u4f55\u5b89\u88c5MariaDB\u3002<\/p>\n<p>\u987a\u4fbf\u4e00\u63d0\uff0cMariaDB \u662f\u4ece MySQL \u5206\u652f\u51fa\u6765\u7684\u5f00\u6e90\u6570\u636e\u5e93\u3002\u6211\u542c\u8bf4\u8fc7 MySQL\uff0c\u4f46\u662f MariaDB \u662f\u7b2c\u4e00\u6b21\u542c\u8bf4\uff01<\/p>\n<h2>\u73af\u5883<\/h2>\n<p>Ubuntu 22.04<br \/>\nNginx 1.22.1<br \/>\nMariaDB 10.6.11\u53ef\u4ee5\u91c7\u7528\u4e0b\u5217\u7684\u6c49\u8bed\u7248\u7ffb\u8bd1\uff1a<\/p>\n<p>\u4e4c\u73ed\u56fe22.04<br \/>\n\u5f15\u64ceX 1.22.1<br \/>\n\u739b\u4e3d\u4e9a\u6570\u636e\u5e9310.6.11<\/p>\n<h2>\u8bbe\u7f6e<\/h2>\n<p>\u5b89\u88c5MariaDB\u3002\u786e\u8ba4\u6d88\u606f\u6309Y\u952e\uff0c\u7136\u540e\u6309\u56de\u8f66\uff01<\/p>\n<pre class=\"post-pre\"><code>$ sudo apt -y install mariadb-server\r\n<\/code><\/pre>\n<p>\u8bf7\u786e\u8ba4\u9ed8\u8ba4\u7684\u5b57\u7b26\u7f16\u7801\u3002<\/p>\n<pre class=\"post-pre\"><code>$ sudo vi \/etc\/mysql\/mariadb.conf.d\/50-server.cnf \r\n<\/code><\/pre>\n<p>\u53ea\u8981\u662f\u8fd9\u6837\u5c31\u53ef\u4ee5\u4e86<\/p>\n<pre class=\"post-pre\"><code>character-set-server  = utf8mb4\r\ncollation-server      = utf8mb4_general_ci\r\n<\/code><\/pre>\n<p>\u8fdb\u884cMariaDB\u7684\u521d\u59cb\u8bbe\u7f6e\u3002<\/p>\n<pre class=\"post-pre\"><code>$ sudo mysql_secure_installation \r\n\r\nNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB\r\n      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!\r\n\r\nIn order to log into MariaDB to secure it, we'll need the current\r\npassword for the root user. If you've just installed MariaDB, and\r\nhaven't set the root password yet, you should just press enter here.\r\n\r\nEnter current password for root (enter for none): \r\nOK, successfully used password, moving on...\r\n\r\nSetting the root password or using the unix_socket ensures that nobody\r\ncan log into the MariaDB root user without the proper authorisation.\r\n\r\nYou already have your root account protected, so you can safely answer 'n'.\r\n\r\nSwitch to unix_socket authentication [Y\/n] n\r\n ... skipping.\r\n\r\nYou already have your root account protected, so you can safely answer 'n'.\r\n\r\nChange the root password? [Y\/n] n\r\n ... skipping.\r\n\r\nBy default, a MariaDB installation has an anonymous user, allowing anyone\r\nto log into MariaDB without having to have a user account created for\r\nthem.  This is intended only for testing, and to make the installation\r\ngo a bit smoother.  You should remove them before moving into a\r\nproduction environment.\r\n\r\nRemove anonymous users? [Y\/n] Y\r\n ... Success!\r\n\r\nNormally, root should only be allowed to connect from 'localhost'.  This\r\nensures that someone cannot guess at the root password from the network.\r\n\r\nDisallow root login remotely? [Y\/n] Y\r\n ... Success!\r\n\r\nBy default, MariaDB comes with a database named 'test' that anyone can\r\naccess.  This is also intended only for testing, and should be removed\r\nbefore moving into a production environment.\r\n\r\nRemove test database and access to it? [Y\/n] Y\r\n - Dropping test database...\r\n ... Success!\r\n - Removing privileges on test database...\r\n ... Success!\r\n\r\nReloading the privilege tables will ensure that all changes made so far\r\nwill take effect immediately.\r\n\r\nReload privilege tables now? [Y\/n] Y\r\n ... Success!\r\n\r\nCleaning up...\r\n\r\nAll done!  If you've completed all of the above steps, your MariaDB\r\ninstallation should now be secure.\r\n\r\nThanks for using MariaDB!\r\n<\/code><\/pre>\n<p>\u8bd5\u8bd5\u8fde\u63a5\u5230MariaDB\u3002<\/p>\n<pre class=\"post-pre\"><code>$ sudo mysql\r\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\r\nYour MariaDB connection id is 38\r\nServer version: 10.6.11-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04\r\n\r\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n\r\nMariaDB [(none)]&gt; \r\n<\/code><\/pre>\n<p>\u5f53\u4f60\u79bb\u5f00\u7684\u65f6\u5019\uff0c\u8bf7\u786e\u4fdd\\q\u54e6\u3002<br \/>\n\u987a\u4fbf\u4e00\u63d0\uff0c\u5148\u786e\u8ba4\u4e00\u4e0b\u662f\u5426\u5df2\u7ecf\u542f\u52a8\u4e86\u54e6\uff0c\u5982\u679c\u72b6\u6001\u662factive\uff08running\uff09\uff0c\u5c31\u53ef\u4ee5\u4e86\u3002<\/p>\n<pre class=\"post-pre\"><code>$ sudo systemctl status mariadb\r\n\u25cf mariadb.service - MariaDB 10.6.11 database server\r\n     Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: enabled)     \r\n     Active: active (running) since Wed 2022-11-30 16:33:55 JST; 23min ago\r\n<\/code><\/pre>\n<p>\u7248\u672c\u53ef\u4ee5\u901a\u8fc7\u8fd9\u4e2a\u6765\u786e\u8ba4\u300210.6.11\u6b63\u5728\u542f\u52a8\u4e2d\uff01<\/p>\n<pre class=\"post-pre\"><code>$ sudo mysql -v\r\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\r\nYour MariaDB connection id is 42\r\nServer version: 10.6.11-MariaDB-0ubuntu0.22.04.1 Ubuntu 22.04\r\n\r\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\r\n\r\nReading history-file \/root\/.mysql_history\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5047\u8bbe,\u6761\u4ef6,\u57fa\u7840,\u8d77\u6b65\u70b9 \u5728\u5b89\u88c5WordPress\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5148\u5b89\u88c5MariaDB\u548cPHP\u3002 \u672c\u6587\u53ea\u8bb2\u8ff0\u4e86\u5982 [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[227],"class_list":["post-28365","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5MariaDB - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8eUbuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-\u5b89\u88c5mariadb\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5MariaDB\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8eUbuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-\u5b89\u88c5mariadb\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-27T09:40:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-11T23:46:51+00:00\" \/>\n<meta name=\"author\" content=\"\u79d1, \u9896\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u9896\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/\",\"name\":\"Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5MariaDB - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2022-09-27T09:40:03+00:00\",\"dateModified\":\"2025-08-11T23:46:51+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e\"},\"description\":\"\u5173\u4e8eUbuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5\u7684\u6280\u672f\u6587\u7ae0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 &#8211; \u5b89\u88c5MariaDB\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e\",\"name\":\"\u79d1, \u9896\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u9896\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keying\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5MariaDB - Blog - Silicon Cloud","description":"\u5173\u4e8eUbuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5\u7684\u6280\u672f\u6587\u7ae0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-\u5b89\u88c5mariadb\/","og_locale":"zh_CN","og_type":"article","og_title":"Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5MariaDB","og_description":"\u5173\u4e8eUbuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5\u7684\u6280\u672f\u6587\u7ae0","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-\u5b89\u88c5mariadb\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2022-09-27T09:40:03+00:00","article_modified_time":"2025-08-11T23:46:51+00:00","author":"\u79d1, \u9896","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u9896","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/","name":"Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5MariaDB - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2022-09-27T09:40:03+00:00","dateModified":"2025-08-11T23:46:51+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e"},"description":"\u5173\u4e8eUbuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 - \u5b89\u88c5\u7684\u6280\u672f\u6587\u7ae0","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Ubuntu 22.04 + Nginx 1.22.1 + MariaDB 10.6.11 &#8211; \u5b89\u88c5MariaDB"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/8ca01ba7f7362ad4edb7da206a12f29e","name":"\u79d1, \u9896","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8a6fb3cc7ba2f69d2189ba532aec4633ea7ed75ac0af162ec367cb3abc0fb2af?s=96&d=mm&r=g","caption":"\u79d1, \u9896"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keying\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/ubuntu-22-04-nginx-1-22-1-mariadb-10-6-11-%e5%ae%89%e8%a3%85mariadb\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/28365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=28365"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/28365\/revisions"}],"predecessor-version":[{"id":56417,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/28365\/revisions\/56417"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=28365"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=28365"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=28365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}