{"id":1653,"date":"2023-02-21T14:19:31","date_gmt":"2023-02-21T06:19:31","guid":{"rendered":"https:\/\/km94.com\/?p=1653"},"modified":"2023-02-21T14:19:31","modified_gmt":"2023-02-21T06:19:31","slug":"vultr-vps%e6%95%99%e7%a8%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85mariadb%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/dy208.cn\/index.php\/2023\/02\/21\/vultr-vps%e6%95%99%e7%a8%8b%ef%bc%9a%e5%a6%82%e4%bd%95%e5%9c%a8ubuntu%e4%b8%8a%e5%ae%89%e8%a3%85mariadb%e6%95%b0%e6%8d%ae%e5%ba%93\/","title":{"rendered":"Vultr VPS\u6559\u7a0b\uff1a\u5982\u4f55\u5728Ubuntu\u4e0a\u5b89\u88c5MariaDB\u6570\u636e\u5e93"},"content":{"rendered":"<p>MariaDB\u662fMySQL\u5173\u7cfb\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u7684\u4e00\u4e2a\u5206\u652f\uff0c\u5b83\u53ef\u5b8c\u5168\u517c\u5bb9MySQL\uff0c\u5305\u542bAPI\u548c\u547d\u4ee4\u884c\uff0c\u6240\u4ee5\u6709\u7684\u7528\u6237\u4f1a\u9009\u62e9MariaDB\u6765\u4ee3\u66ffMySQL\u3002\u8fd1\u671f\u6709\u7f51\u53cb\u54a8\u8be2\u60f3\u8981\u7ed9Vultr VPS\u5b89\u88c5\u4e0aMariaDB\u6570\u636e\u5e93\uff0c\u8be5\u6b3eVultr VPS\u64cd\u4f5c\u7cfb\u7edf\u662fUbuntu 20.10 LTS\uff0c\u4e0b\u9762\u5c31\u6765\u770b\u4e0b\u5728Ubuntu\u4e0a\u5b89\u88c5MariaDB\u6570\u636e\u5e93\u6559\u7a0b\u4ecb\u7ecd\u3002<\/p>\n<p>1\u3001\u9996\u5148\u4ee5\u975eroot\u8d26\u6237\u767b\u5f55\u8fde\u63a5\u5230\u60a8\u7684Vultr VPS\uff0c\u7136\u540e\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5MariaDB\uff1a<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\">$ sudo apt install mariadb-server mariadb-client -y<\/code><\/pre>\n<p>2\u3001\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u542f\u7528 MariaDB\uff1a<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\">$ sudo systemctl enable mariadb.service<\/code><\/pre>\n<p>3\u3001\u6570\u636e\u5e93\u5b89\u5168\u4fdd\u62a4\u8bbe\u7f6e\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\">$ sudo mysql_secure_installation<\/code><\/pre>\n<p>\u7136\u540e\u6839\u636e\u9875\u9762\u63d0\u793a\uff0c\u8f93\u5165\u5bc6\u7801\u3002\u6700\u521d\uff0croot \u6ca1\u6709\u5bc6\u7801\uff0c\u76f4\u63a5\u6309\u4e0bEnter\u952e\u8fdb\u884c\u4e0b\u4e00\u6b65\u3002<\/p>\n<p>Enter current password for root (enter for none):<\/p>\n<p>\u6309Enter\u8f93\u5165\u65b0\u5bc6\u7801\u3002<\/p>\n<p>Set root password? [Y\/n]<\/p>\n<p>\u8f93\u5165\u5e76\u786e\u8ba4 MariaDB \u7684 root \u5bc6\u7801\u3002<\/p>\n<p>New password:<\/p>\n<p>Re-enter new password:<\/p>\n<p>Password updated successfully!<\/p>\n<p>\u6309Enter\u5220\u9664\u533f\u540d\u7528\u6237\u3002<\/p>\n<p>Remove anonymous users? [Y\/n]<\/p>\n<p>\u6309\u4e0bEnter\u4ee5\u7981\u6b62\u8fdc\u7a0b root \u767b\u5f55\u3002<\/p>\n<p>Disallow root login remotely? [Y\/n]<\/p>\n<p>\u6309Enter\u5220\u9664\u6d4b\u8bd5\u6570\u636e\u5e93\u3002<\/p>\n<p>Remove test database and access to it? [Y\/n]<\/p>\n<p>\u6309Enter\u91cd\u65b0\u52a0\u8f7d\u6743\u9650\u8868\u3002<\/p>\n<p>Reload privilege tables now? [Y\/n]<\/p>\n<p>\u8fd9\u6837\u5c31\u5b8c\u6210\u4e86\u57fa\u672c\u7684\u5b89\u5168\u914d\u7f6e\u3002\u63a5\u4e0b\u6765\u60a8\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u64cd\u4f5c\u6b65\u9aa4\u8fdb\u884c\u6d4b\u8bd5\uff08\u5982\u521b\u5efa\u4e00\u4e2a\u6d4b\u8bd5\u6570\u636e\u5e93\u3001\u8bbe\u7f6e\u6570\u636e\u5e93\u6743\u9650\u7b49\uff09\u3002<\/p>\n<p>\u2460\u4ee5 root \u8eab\u4efd\u8fde\u63a5\u5230\u6570\u636e\u5e93\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\"># mysql -u root -p -h localhost<\/code><\/pre>\n<p>\u2461\u521b\u5efa\u4e00\u4e2a\u6d4b\u8bd5\u7528\u6237test_user\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\">CREATE USER &#8216;test_user&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;test_pass&#8217;;<\/code><\/pre>\n<p>\u2462\u521b\u5efa\u4e00\u4e2a\u6d4b\u8bd5\u6570\u636e\u5e93test_database\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\">CREATE DATABASE test_database;<\/code><\/pre>\n<p>\u2463\u6388\u4e88\u6d4b\u8bd5\u7528\u6237\u5bf9\u6d4b\u8bd5\u6570\u636e\u5e93\u7684\u6743\u9650\uff08\u7ed9\u7528\u6237\u6dfb\u52a0\u4e0a\u6240\u6709\u6743\u9650\uff0c\u5220\u9664\u3001\u6dfb\u52a0\u3001\u4fee\u6539\u6570\u636e\u5e93\u8868\u7b49\uff09\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\">GRANT ALL PRIVILEGES ON test_database.* TO &#8216;test_user&#8217;@&#8217;localhost&#8217;;<\/code><\/pre>\n<p>\u2464\u9000\u51fa\u6570\u636e\u5e93\u5ba2\u6237\u7aef\u3002<\/p>\n<pre class=\"wp-block-code\"><code class=\"hljs text\"><span class=\"hljs-selector-tag\">quit<\/code><\/pre>\n<div>\n<div>\n<\/div>\n<div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>MariaDB\u662fMySQL\u5173\u7cfb\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u7684\u4e00\u4e2a\u5206\u652f\uff0c\u5b83\u53ef\u5b8c\u5168\u517c\u5bb9MySQL\uff0c\u5305\u542bAPI\u548c\u547d\u4ee4\u884c\uff0c\u6240\u4ee5\u6709\u7684\u7528&hellip;<\/p>\n","protected":false},"author":1,"featured_media":1654,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,2],"tags":[],"class_list":["post-1653","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-zjjc","category-jc","entry"],"_links":{"self":[{"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/posts\/1653","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1653"}],"version-history":[{"count":0,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/posts\/1653\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1653"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dy208.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}