{"id":114976,"date":"2026-10-10T17:49:08","date_gmt":"2026-10-10T09:49:08","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/114976.html"},"modified":"2026-10-10T17:49:08","modified_gmt":"2026-10-10T09:49:08","slug":"mariadb-%e8%bf%9b%e9%98%b6%ef%bc%88%e6%95%b0%e6%8d%ae%e8%a1%a8-%e7%94%a8%e6%88%b7-%e5%a4%87%e4%bb%bd-%e4%b8%bb%e4%bb%8e%ef%bc%89%e4%b8%8e-nginx-%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%85%a5%e9%97%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/114976.html","title":{"rendered":"MariaDB \u8fdb\u9636\uff08\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece\uff09\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8"},"content":{"rendered":"<h2>MariaDB \u8fdb\u9636&#xff08;\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece&#xff09;\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8<\/h2>\n<p>\u672c\u6587\u4f7f\u7528\u901a\u4fd7\u5316\u3001\u4f53\u7cfb\u5316\u7684\u8bed\u8a00\u8bb2\u89e3MariaDB \u8fdb\u9636\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8\u7684\u76f8\u5173\u77e5\u8bc6&#xff0c;\u6bcf\u4e2a\u6982\u5ff5\u8bb2\u6e05\u300c\u662f\u4ec0\u4e48\u3001\u4e3a\u4ec0\u4e48\u3001\u600e\u4e48\u7528\u300d&#xff0c;\u6bcf\u6761\u547d\u4ee4\u89e3\u91ca\u300c\u610f\u56fe\u548c\u539f\u56e0\u300d&#xff0c;\u5e76\u901a\u8fc7\u5bf9\u6bd4\u8868\u683c\u3001\u67b6\u6784\u56fe\u89e3\u3001\u573a\u666f\u6807\u6ce8\u5e2e\u52a9\u7406\u89e3\u3002<\/p>\n<p>&#x1f4cc; \u6807\u6ce8\u7ea6\u5b9a&#xff1a;<\/p>\n<ul>\n<li>\u3010\u4f7f\u7528\u9891\u7387\u3011\u771f\u5b9e\u8fd0\u7ef4\u5de5\u4f5c\u4e2d\u7684\u51fa\u73b0\u9891\u7387&#xff1a;\u6781\u9ad8 \/ \u9ad8 \/ \u4e2d \/ \u4f4e<\/li>\n<li>\u2b50 \u91cd\u70b9\u3000&#x1f53a; \u96be\u70b9&#xff08;\u6613\u8e29\u5751&#xff09;\u3000&#x1f4a1; \u7406\u89e3\u6280\u5de7 \/ \u751f\u4ea7\u7ecf\u9a8c<\/li>\n<\/ul>\n<p>&#x1f527; \u672c\u6587\u7edf\u4e00\u4f7f\u7528\u7684\u5b9e\u9a8c\u73af\u5883&#xff1a;<\/p>\n<table>\n<tr>\u89d2\u8272\u4e3b\u673a\u540dIP \u5730\u5740\u7528\u9014<\/tr>\n<tbody>\n<tr>\n<td>\u901a\u7528\u670d\u52a1\u7aef<\/td>\n<td>server<\/td>\n<td>10.1.8.11<\/td>\n<td>Nginx \u7b49<\/td>\n<\/tr>\n<tr>\n<td>\u901a\u7528\u5ba2\u6237\u7aef<\/td>\n<td>client<\/td>\n<td>10.1.8.12<\/td>\n<td>\u8bbf\u95ee\u6d4b\u8bd5<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u5e93\u4e3b\u5e93<\/td>\n<td>db1&#xff08;db1.hero.cloud&#xff09;<\/td>\n<td>10.1.8.13<\/td>\n<td>MySQL \u4e3b<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u5e93\u4ece\u5e93<\/td>\n<td>db2&#xff08;db2.hero.cloud&#xff09;<\/td>\n<td>10.1.8.14<\/td>\n<td>MySQL \u4ece<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>\u57df\u540d\u7edf\u4e00\u4e3a hero.cloud&#xff1b;<\/li>\n<li>\u6570\u636e\u5e93\u76f8\u5173\u5bc6\u7801\u7edf\u4e00\u4e3a 123\u3002<\/li>\n<\/ul>\n<p>\u4eca\u65e5\u5185\u5bb9\u5730\u56fe&#xff1a;<\/p>\n<table>\n<tr>\u7bc7\u5185\u5bb9<\/tr>\n<tbody>\n<tr>\n<td>\u7b2c\u4e00\u7bc7 MariaDB \u8fdb\u9636<\/td>\n<td>\u6570\u636e\u8868 CRUD\u3001\u7528\u6237\u4e0e\u6743\u9650\u3001\u5907\u4efd\u6062\u590d\u3001\u4e3b\u4ece\u540c\u6b65\u3001\u5e94\u6025<\/td>\n<\/tr>\n<tr>\n<td>\u7b2c\u4e8c\u7bc7 Nginx<\/td>\n<td>\u4ecb\u7ecd\u3001\u90e8\u7f72\u3001\u914d\u7f6e\u7ed3\u6784\u3001nginx.conf\u3001\u865a\u62df\u4e3b\u673a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>MariaDB \u8fdb\u9636&#xff08;\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece&#xff09;\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8<\/li>\n<li>\u7b2c\u4e00\u7bc7\u3000MariaDB \u8fdb\u9636<\/li>\n<li>\n<ul>\n<li>\u7b2c 1 \u7ae0\u3000\u6570\u636e\u8868\u64cd\u4f5c&#xff08;CRUD&#xff09;<\/li>\n<li>\n<ul>\n<li>1.1 \u73af\u5883\u51c6\u5907&#xff1a;\u5bfc\u5165\u793a\u4f8b\u5e93<\/li>\n<li>1.2 \u67e5\u8be2\u8868<\/li>\n<li>1.3 \u6761\u4ef6\u67e5\u8be2&#xff08;\u2b50 WHERE&#xff09;<\/li>\n<li>1.4 \u805a\u5408\u51fd\u6570\u4e0e\u5206\u7ec4<\/li>\n<li>1.5 \u591a\u8868\u67e5\u8be2&#xff08;&#x1f53a; \u8fde\u63a5&#xff09;<\/li>\n<li>1.6 \u5efa\u8868\u3001\u63d2\u5165\u3001\u66f4\u65b0\u3001\u5220\u9664<\/li>\n<\/ul>\n<\/li>\n<li>\u7b2c 2 \u7ae0\u3000\u7ba1\u7406\u6570\u636e\u5e93\u7528\u6237<\/li>\n<li>\n<ul>\n<li>2.1 \u8d26\u53f7\u683c\u5f0f user&#064;host<\/li>\n<li>2.2 \u521b\u5efa\u7528\u6237<\/li>\n<li>2.3 \u6388\u6743 GRANT&#xff08;\u2b50 \u56db\u7ea7\u7c92\u5ea6&#xff09;<\/li>\n<li>2.4 \u67e5\u770b \/ \u56de\u6536 \/ \u5220\u9664 \/ \u6539\u5bc6\u7801<\/li>\n<li>2.5 \u5e38\u89c1\u8bbf\u95ee\u6545\u969c<\/li>\n<\/ul>\n<\/li>\n<li>\u7b2c 3 \u7ae0\u3000\u5907\u4efd\u548c\u6062\u590d<\/li>\n<li>\n<ul>\n<li>3.1 \u2b50 \u903b\u8f91\u5907\u4efd vs \u7269\u7406\u5907\u4efd<\/li>\n<li>3.2 \u7269\u7406\u5907\u4efd \/ \u6062\u590d<\/li>\n<li>3.3 \u903b\u8f91\u5907\u4efd mysqldump&#xff08;\u2b50 \u6700\u5e38\u7528&#xff09;<\/li>\n<\/ul>\n<\/li>\n<li>\u7b2c 4 \u7ae0\u3000\u4e3b\u4ece\u540c\u6b65<\/li>\n<li>\n<ul>\n<li>4.1 \u2b50 \u540c\u6b65\u539f\u7406&#xff08;&#x1f53a; \u6838\u5fc3&#xff0c;\u52a1\u5fc5\u7406\u89e3&#xff09;<\/li>\n<li>4.2 \u5e38\u89c1\u67b6\u6784<\/li>\n<li>4.3 \u4e09\u79cd\u590d\u5236\u65b9\u5f0f<\/li>\n<li>4.4 \u4e3b\u4ece\u5ef6\u8fdf<\/li>\n<li>4.5 \u2b50 \u4e3b\u4ece\u540c\u6b65\u5b9e\u8df5&#xff08;db1 &#061; 10.1.8.13 \u4e3b&#xff0c;db2 &#061; 10.1.8.14 \u4ece&#xff09;<\/li>\n<li>4.6 \u9632\u6b62\u6570\u636e\u4e22\u5931\u7684\u5173\u952e\u53c2\u6570<\/li>\n<\/ul>\n<\/li>\n<li>\u7b2c 5 \u7ae0\u3000\u5e94\u6025\u573a\u666f&#xff08;&#x1f53a; \u6551\u547d&#xff09;<\/li>\n<li>\n<ul>\n<li>5.1 \u5fd8\u8bb0 root \u5bc6\u7801<\/li>\n<li>5.2 root \u6743\u9650\u88ab\u8bef\u56de\u6536<\/li>\n<li>5.3 root \u8d26\u53f7\u88ab\u8bef\u5220\u9664<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\u7b2c\u4e8c\u7bc7\u3000Nginx \u670d\u52a1\u5668<\/li>\n<li>\n<ul>\n<li>\u7b2c 6 \u7ae0\u3000Nginx \u4ecb\u7ecd<\/li>\n<li>\u7b2c 7 \u7ae0\u3000Nginx \u90e8\u7f72<\/li>\n<li>\u7b2c 8 \u7ae0\u3000Nginx \u914d\u7f6e\u7ed3\u6784&#xff08;\u2b50 \u5c42\u7ea7\u5316&#xff09;<\/li>\n<li>\u7b2c 9 \u7ae0\u3000nginx.conf \u8be6\u89e3\u8981\u70b9<\/li>\n<li>\u7b2c 10 \u7ae0\u3000\u914d\u7f6e\u52a0\u8f7d\u4e0e location \u5339\u914d&#xff08;&#x1f53a;&#xff09;<\/li>\n<li>\u7b2c 11 \u7ae0\u3000\u865a\u62df\u4e3b\u673a<\/li>\n<li>\n<ul>\n<li>11.1 \u57fa\u4e8e\u57df\u540d&#xff08;\u2b50 \u6700\u5e38\u7528&#xff09;<\/li>\n<li>11.2 \u57fa\u4e8e\u7aef\u53e3<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>\u603b\u7ed3\u7bc7<\/li>\n<li>\n<ul>\n<li>\u4e00\u3001\u6838\u5fc3\u77e5\u8bc6\u94fe\u8def<\/li>\n<li>\u4e8c\u3001\u91cd\u70b9 \/ \u96be\u70b9 \/ \u9891\u7387<\/li>\n<li>\u4e09\u3001\u6613\u9519\u6e05\u5355<\/li>\n<li>\u56db\u3001\u9762\u8bd5\u901f\u8bb0<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>\u7b2c\u4e00\u7bc7\u3000MariaDB \u8fdb\u9636<\/h2>\n<h3>\u7b2c 1 \u7ae0\u3000\u6570\u636e\u8868\u64cd\u4f5c&#xff08;CRUD&#xff09;<\/h3>\n<p>\u3010\u4f7f\u7528\u9891\u7387&#xff1a;\u6781\u9ad8\u3011CRUD &#061; Create \u589e\u3001Read \u67e5\u3001Update \u6539\u3001Delete \u5220&#xff0c;\u662f\u6570\u636e\u5e93\u6700\u6838\u5fc3\u7684\u65e5\u5e38\u64cd\u4f5c\u3002<\/p>\n<h4>1.1 \u73af\u5883\u51c6\u5907&#xff1a;\u5bfc\u5165\u793a\u4f8b\u5e93<\/h4>\n<p><span class=\"token comment\"># \u4e0b\u8f7d\u793a\u4f8b SQL<\/span><br \/>\n<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-o<\/span> inventory.sql <span class=\"token parameter variable\">-s<\/span> http:\/\/192.168.49.200\/class\/course-materials\/softwares\/stage01\/inventory.middle.sql<br \/>\n<span class=\"token comment\"># \u5efa\u5e93\u5e76\u5bfc\u5165<\/span><br \/>\nmysql <span class=\"token parameter variable\">-uroot<\/span> <span class=\"token parameter variable\">-p123<\/span> <span class=\"token parameter variable\">-e<\/span> <span class=\"token string\">&#039;create database inventory;&#039;<\/span><br \/>\nmysql <span class=\"token parameter variable\">-uroot<\/span> <span class=\"token parameter variable\">-p123<\/span> inventory <span class=\"token operator\">&lt;<\/span> inventory.sql<\/p>\n<p>\u539f\u7406&#xff1a;mysql \u5e93\u540d &lt; \u6587\u4ef6 \u8868\u793a\u628a SQL \u6587\u4ef6\u91cc\u7684\u8bed\u53e5\u6279\u91cf\u704c\u8fdb\u6307\u5b9a\u5e93\u3002<\/p>\n<h4>1.2 \u67e5\u8be2\u8868<\/h4>\n<p>\u2460 \u8868\u5217\u8868&#xff1a;<\/p>\n<p><span class=\"token keyword\">USE<\/span> inventory<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SHOW<\/span> <span class=\"token keyword\">TABLES<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">&#8212; category \/ manufacturer \/ product<\/span><\/p>\n<p>\u2461 \u8868\u7ed3\u6784&#xff08;\u2b50 DESCRIBE&#xff09;&#xff1a;<\/p>\n<p><span class=\"token keyword\">DESCRIBE<\/span> product<span class=\"token punctuation\">;<\/span>     <span class=\"token comment\">&#8212; \u53ef\u7b80\u5199 DESC product;<\/span><\/p>\n<table>\n<tr>\u5217\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>Field<\/td>\n<td>\u5b57\u6bb5&#xff08;\u5217&#xff09;\u540d<\/td>\n<\/tr>\n<tr>\n<td>Type<\/td>\n<td>\u6570\u636e\u7c7b\u578b&#xff08;int \u6574\u6570\u3001varchar \u53d8\u957f\u5b57\u7b26\u4e32\u3001double \u6d6e\u70b9&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Null<\/td>\n<td>\u662f\u5426\u5141\u8bb8\u4e3a\u7a7a&#xff08;NO &#061; \u5fc5\u586b&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Key<\/td>\n<td>PRI \u8868\u793a\u4e3b\u952e<\/td>\n<\/tr>\n<tr>\n<td>Default<\/td>\n<td>\u9ed8\u8ba4\u503c<\/td>\n<\/tr>\n<tr>\n<td>Extra<\/td>\n<td>auto_increment \u81ea\u589e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f4a1; \u4e3b\u952e&#xff08;PRIMARY KEY&#xff09;&#xff1a;\u4e00\u884c\u7684\u552f\u4e00\u8eab\u4efd\u8bc1&#xff0c;\u4efb\u4f55\u4e24\u884c\u4e3b\u952e\u4e0d\u80fd\u76f8\u540c\u3002\u81ea\u589e&#xff08;auto_increment&#xff09;&#xff1a;\u63d2\u5165\u65f6\u4e0d\u6307\u5b9a&#xff0c;\u6570\u636e\u5e93\u81ea\u52a8 &#043;1&#xff0c;\u4fdd\u8bc1\u4e3b\u952e\u552f\u4e00\u3002<\/p>\n<p>\u2462 \u67e5\u8be2\u6570\u636e&#xff1a;<\/p>\n<p><span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> product<span class=\"token punctuation\">;<\/span>                 <span class=\"token comment\">&#8212; * \u8868\u793a\u6240\u6709\u5217&#xff0c;\u67e5\u5168\u90e8\u8bb0\u5f55<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> name<span class=\"token punctuation\">,<\/span>price<span class=\"token punctuation\">,<\/span>stock <span class=\"token keyword\">FROM<\/span> product<span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">&#8212; \u53ea\u67e5\u6307\u5b9a\u5217&#xff08;\u63a8\u8350&#xff0c;\u6570\u636e\u91cf\u5c0f\u3001\u66f4\u6e05\u6670&#xff09;<\/span><\/p>\n<h4>1.3 \u6761\u4ef6\u67e5\u8be2&#xff08;\u2b50 WHERE&#xff09;<\/h4>\n<p><span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> product <span class=\"token keyword\">WHERE<\/span> price <span class=\"token operator\">&gt;<\/span> <span class=\"token number\">100<\/span><span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">&#8212; \u53ea\u8fd4\u56de\u6ee1\u8db3\u6761\u4ef6\u7684\u884c<\/span><\/p>\n<p>\u6bd4\u8f83\u8fd0\u7b97\u7b26&#xff1a;<\/p>\n<table>\n<tr>\u8fd0\u7b97\u7b26\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>&#061;<\/td>\n<td>\u7b49\u4e8e<\/td>\n<\/tr>\n<tr>\n<td>&lt;&gt;&#xff08;\u6216 !&#061;&#xff09;<\/td>\n<td>\u4e0d\u7b49\u4e8e<\/td>\n<\/tr>\n<tr>\n<td>&gt; &lt; &gt;&#061; &lt;&#061;<\/td>\n<td>\u5927\u5c0f\u6bd4\u8f83<\/td>\n<\/tr>\n<tr>\n<td>BETWEEN a AND b<\/td>\n<td>\u5728 a~b \u4e4b\u95f4&#xff08;\u542b\u8fb9\u754c&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>IN (&#8230;)<\/td>\n<td>\u5728\u7ed9\u5b9a\u5217\u8868\u4e2d<\/td>\n<\/tr>\n<tr>\n<td>LIKE<\/td>\n<td>\u6a21\u7cca\u5339\u914d&#xff1a;% \u4efb\u610f\u591a\u4e2a\u5b57\u7b26&#xff0c;_ \u6070\u597d\u4e00\u4e2a\u5b57\u7b26<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> product <span class=\"token keyword\">WHERE<\/span> id <span class=\"token operator\">BETWEEN<\/span> <span class=\"token number\">1<\/span> <span class=\"token operator\">AND<\/span> <span class=\"token number\">3<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> category <span class=\"token keyword\">WHERE<\/span> name <span class=\"token operator\">IN<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;Servers&#039;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token string\">&#039;Ssd&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> product <span class=\"token keyword\">WHERE<\/span> name <span class=\"token operator\">LIKE<\/span> <span class=\"token string\">&#039;%Server%&#039;<\/span><span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">&#8212; \u540d\u5b57\u4e2d\u542b Server<\/span><\/p>\n<p>\u903b\u8f91\u7ec4\u5408\u4e0e\u6392\u5e8f&#xff1a;<\/p>\n<p><span class=\"token comment\">&#8212; AND \u4e14\u3001OR \u6216<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> product <span class=\"token keyword\">WHERE<\/span> name <span class=\"token operator\">LIKE<\/span> <span class=\"token string\">&#039;%RD%&#039;<\/span> <span class=\"token operator\">AND<\/span> price<span class=\"token operator\">&gt;<\/span><span class=\"token number\">1000<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> product <span class=\"token keyword\">WHERE<\/span> name <span class=\"token operator\">LIKE<\/span> <span class=\"token string\">&#039;%RD%&#039;<\/span> <span class=\"token operator\">OR<\/span> price<span class=\"token operator\">&gt;<\/span><span class=\"token number\">500<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">&#8212; ORDER BY \u6392\u5e8f&#xff0c;ASC \u5347\u5e8f&#xff08;\u9ed8\u8ba4&#xff09;&#xff0c;DESC \u964d\u5e8f<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> product <span class=\"token keyword\">ORDER<\/span> <span class=\"token keyword\">BY<\/span> price<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> product <span class=\"token keyword\">ORDER<\/span> <span class=\"token keyword\">BY<\/span> price <span class=\"token keyword\">DESC<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h4>1.4 \u805a\u5408\u51fd\u6570\u4e0e\u5206\u7ec4<\/h4>\n<table>\n<tr>\u51fd\u6570\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>avg()<\/td>\n<td>\u5e73\u5747\u503c<\/td>\n<\/tr>\n<tr>\n<td>max() \/ min()<\/td>\n<td>\u6700\u5927 \/ \u6700\u5c0f<\/td>\n<\/tr>\n<tr>\n<td>sum()<\/td>\n<td>\u6c42\u548c<\/td>\n<\/tr>\n<tr>\n<td>count()<\/td>\n<td>\u8ba1\u6570&#xff08;\u884c\u6570&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><span class=\"token keyword\">SELECT<\/span> <span class=\"token function\">avg<\/span><span class=\"token punctuation\">(<\/span>price<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">FROM<\/span> product<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> <span class=\"token function\">sum<\/span><span class=\"token punctuation\">(<\/span>stock<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">FROM<\/span> product<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">&#8212; \u67e5\u6700\u8d35\u4ea7\u54c1&#xff1a;\u5b50\u67e5\u8be2<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> product <span class=\"token keyword\">WHERE<\/span> price<span class=\"token operator\">&#061;<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">SELECT<\/span> <span class=\"token function\">max<\/span><span class=\"token punctuation\">(<\/span>price<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">FROM<\/span> product<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">&#8212; GROUP BY&#xff1a;\u6309\u67d0\u5217\u5206\u7ec4\u540e\u805a\u5408&#xff08;\u5982\u6bcf\u4e2a\u7c7b\u522b\u5e93\u5b58\u5408\u8ba1&#xff09;<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> id_category<span class=\"token punctuation\">,<\/span> <span class=\"token function\">sum<\/span><span class=\"token punctuation\">(<\/span>stock<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">FROM<\/span> product <span class=\"token keyword\">GROUP<\/span> <span class=\"token keyword\">BY<\/span> id_category<span class=\"token punctuation\">;<\/span><\/p>\n<h4>1.5 \u591a\u8868\u67e5\u8be2&#xff08;&#x1f53a; \u8fde\u63a5&#xff09;<\/h4>\n<p>\u5f53\u6570\u636e\u5206\u6563\u5728\u591a\u5f20\u8868&#xff0c;\u9700\u8981\u9760&#034;\u5173\u8054\u5b57\u6bb5&#034;\u62fc\u63a5&#xff1a;<\/p>\n<p><span class=\"token comment\">&#8212; \u67e5\u7c7b\u578b\u4e3a Servers \u7684\u4ea7\u54c1\u540d\u548c\u4ef7\u683c<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> product<span class=\"token punctuation\">.<\/span>name<span class=\"token punctuation\">,<\/span> product<span class=\"token punctuation\">.<\/span>price<br \/>\n<span class=\"token keyword\">FROM<\/span> product<span class=\"token punctuation\">,<\/span> category<br \/>\n<span class=\"token keyword\">WHERE<\/span> product<span class=\"token punctuation\">.<\/span>id_category <span class=\"token operator\">&#061;<\/span> category<span class=\"token punctuation\">.<\/span>id    <span class=\"token comment\">&#8212; \u5173\u8054\u6761\u4ef6<\/span><br \/>\n  <span class=\"token operator\">AND<\/span> category<span class=\"token punctuation\">.<\/span>name<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;Servers&#039;<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>&#x1f4a1; product.id_category &#061; category.id \u662f\u8fde\u63a5\u7684\u5173\u952e&#xff0c;\u6f0f\u6389\u4f1a\u4ea7\u751f&#034;\u7b1b\u5361\u5c14\u79ef&#034;&#xff08;\u884c\u6570\u7206\u70b8&#xff09;\u3002<\/p>\n<h4>1.6 \u5efa\u8868\u3001\u63d2\u5165\u3001\u66f4\u65b0\u3001\u5220\u9664<\/h4>\n<p>\u2460 \u5efa\u8868 CREATE TABLE&#xff1a;<\/p>\n<p><span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">TABLE<\/span> staff<span class=\"token punctuation\">(<\/span><br \/>\n  id <span class=\"token keyword\">INT<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">11<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">NOT<\/span> <span class=\"token boolean\">NULL<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  name <span class=\"token keyword\">VARCHAR<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">100<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">NOT<\/span> <span class=\"token boolean\">NULL<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  age <span class=\"token keyword\">INT<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">11<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">DEFAULT<\/span> <span class=\"token number\">10<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  id_department <span class=\"token keyword\">INT<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">11<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u2461 \u63d2\u5165 INSERT&#xff1a;<\/p>\n<p><span class=\"token keyword\">INSERT<\/span> <span class=\"token keyword\">INTO<\/span> staff <span class=\"token punctuation\">(<\/span>id<span class=\"token punctuation\">,<\/span>name<span class=\"token punctuation\">,<\/span>age<span class=\"token punctuation\">,<\/span>id_department<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">VALUES<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span><span class=\"token string\">&#039;hero1&#039;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token number\">28<\/span><span class=\"token punctuation\">,<\/span><span class=\"token number\">10<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">INSERT<\/span> <span class=\"token keyword\">INTO<\/span> staff <span class=\"token punctuation\">(<\/span>id<span class=\"token punctuation\">,<\/span>name<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">VALUES<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token number\">2<\/span><span class=\"token punctuation\">,<\/span><span class=\"token string\">&#039;hero2&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">&#8212; \u672a\u7ed9\u7684\u5217\u7528\u9ed8\u8ba4\u503c\/NULL<\/span><\/p>\n<p>\u2462 \u66f4\u65b0 UPDATE&#xff08;&#x1f53a;&#xff09;&#xff1a;<\/p>\n<p><span class=\"token keyword\">UPDATE<\/span> staff <span class=\"token keyword\">SET<\/span> age<span class=\"token operator\">&#061;<\/span><span class=\"token number\">30<\/span> <span class=\"token keyword\">WHERE<\/span> id<span class=\"token operator\">&#061;<\/span><span class=\"token number\">3<\/span><span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">&#8212; \u53ea\u6539 id&#061;3 \u8fd9\u884c<\/span><br \/>\n<span class=\"token keyword\">UPDATE<\/span> staff <span class=\"token keyword\">SET<\/span> age<span class=\"token operator\">&#061;<\/span><span class=\"token number\">30<\/span><span class=\"token punctuation\">;<\/span>              <span class=\"token comment\">&#8212; \u26a0\ufe0f \u6ca1\u6709 WHERE&#xff0c;\u5168\u8868\u6240\u6709\u884c\u90fd\u88ab\u6539&#xff01;<\/span><\/p>\n<p>\u2463 \u5220\u9664 DELETE&#xff08;&#x1f53a;&#xff09;&#xff1a;<\/p>\n<p><span class=\"token keyword\">DELETE<\/span> <span class=\"token keyword\">FROM<\/span> staff <span class=\"token keyword\">WHERE<\/span> id<span class=\"token operator\">&#061;<\/span><span class=\"token number\">3<\/span><span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">&#8212; \u53ea\u5220 id&#061;3<\/span><br \/>\n<span class=\"token keyword\">DELETE<\/span> <span class=\"token keyword\">FROM<\/span> staff<span class=\"token punctuation\">;<\/span>              <span class=\"token comment\">&#8212; \u26a0\ufe0f \u6ca1\u6709 WHERE&#xff0c;\u6e05\u7a7a\u5168\u8868&#xff08;\u8868\u7ed3\u6784\u8fd8\u5728&#xff09;<\/span><\/p>\n<p>\u2464 \u5220\u9664\u8868 DROP TABLE&#xff1a;<\/p>\n<p><span class=\"token keyword\">DROP<\/span> <span class=\"token keyword\">TABLE<\/span> staff<span class=\"token punctuation\">;<\/span>               <span class=\"token comment\">&#8212; \u8fde\u8868\u7ed3\u6784\u5e26\u6570\u636e\u4e00\u8d77\u5220\u9664&#xff08;\u6700\u5f7b\u5e95&#xff09;<\/span><\/p>\n<p>&#x1f53a; DELETE vs DROP \u533a\u522b&#xff08;\u9ad8\u9891\u9762\u8bd5&#xff09;&#xff1a;DELETE \u5220\u300c\u6570\u636e\u884c\u300d&#xff0c;\u8868\u8fd8\u5728&#xff1b;DROP \u5220\u300c\u6574\u5f20\u8868\u300d&#xff08;\u7ed3\u6784&#043;\u6570\u636e&#xff09;\u3002TRUNCATE \u5219\u662f\u5feb\u901f\u6e05\u7a7a\u5168\u8868\u6570\u636e\u3002<\/p>\n<hr \/>\n<h3>\u7b2c 2 \u7ae0\u3000\u7ba1\u7406\u6570\u636e\u5e93\u7528\u6237<\/h3>\n<p>\u3010\u4f7f\u7528\u9891\u7387&#xff1a;\u9ad8\u3011\u6570\u636e\u5e93\u8d26\u53f7\u4e0e Linux \u7cfb\u7edf\u8d26\u53f7\u662f\u4e24\u5957\u72ec\u7acb\u4f53\u7cfb&#xff0c;\u5373\u4f7f\u540c\u540d\u4e5f\u65e0\u5173\u3002<\/p>\n<h4>2.1 \u8d26\u53f7\u683c\u5f0f user&#064;host<\/h4>\n<p>\u8d26\u53f7\u7531\u300c\u7528\u6237\u540d &#043; \u6765\u6e90\u4e3b\u673a\u300d\u7ec4\u6210&#xff0c;\u540c\u540d\u7528\u6237\u53ef\u56e0\u6765\u6e90\u4e0d\u540c\u800c\u6743\u9650\u4e0d\u540c&#xff1a;<\/p>\n<table>\n<tr>\u8d26\u53f7\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>hero \u6216 hero&#064;&#039;%&#039;<\/td>\n<td>\u53ef\u4ece\u4efb\u610f\u4e3b\u673a\u8fde\u63a5<\/td>\n<\/tr>\n<tr>\n<td>hero&#064;&#039;localhost&#039;<\/td>\n<td>\u53ea\u80fd\u672c\u673a\u8fde\u63a5<\/td>\n<\/tr>\n<tr>\n<td>hero&#064;&#039;10.1.8.12&#039;<\/td>\n<td>\u53ea\u80fd\u4ece\u6307\u5b9a IP<\/td>\n<\/tr>\n<tr>\n<td>hero&#064;&#039;10.1.8.%&#039;<\/td>\n<td>\u53ef\u4ece 10.1.8.0\/24 \u7f51\u6bb5<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>2.2 \u521b\u5efa\u7528\u6237<\/h4>\n<p><span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">USER<\/span> hero<span class=\"token variable\">&#064;&#039;%&#039;<\/span> IDENTIFIED <span class=\"token keyword\">BY<\/span> <span class=\"token string\">&#039;123&#039;<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u65b0\u7528\u6237\u9ed8\u8ba4\u53ea\u6709\u6700\u5c0f\u6743\u9650&#xff0c;\u4ec0\u4e48\u5e93\u8868\u90fd\u64cd\u4f5c\u4e0d\u4e86&#xff0c;\u5fc5\u987b\u518d\u6388\u6743\u3002 \u5bc6\u7801\u7ecf\u52a0\u5bc6\u540e\u5b58\u5728 mysql.user \u8868&#xff08;\u4e0d\u662f\u660e\u6587&#xff09;\u3002<\/p>\n<h4>2.3 \u6388\u6743 GRANT&#xff08;\u2b50 \u56db\u7ea7\u7c92\u5ea6&#xff09;<\/h4>\n<p><span class=\"token keyword\">GRANT<\/span> \u6743\u9650<span class=\"token number\">1<\/span><span class=\"token punctuation\">,<\/span>\u6743\u9650<span class=\"token number\">2<\/span> <span class=\"token keyword\">ON<\/span> \u8303\u56f4 <span class=\"token keyword\">TO<\/span> <span class=\"token string\">&#039;\u7528\u6237&#039;<\/span><span class=\"token variable\">&#064;&#039;\u4e3b\u673a&#039;<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<table>\n<tr>\u8303\u56f4\u5199\u6cd5\u9002\u7528<\/tr>\n<tbody>\n<tr>\n<td>\u5168\u5c40<\/td>\n<td>*.*<\/td>\n<td>DBA\u3001\u8d85\u7ea7\u7ba1\u7406\u5458<\/td>\n<\/tr>\n<tr>\n<td>\u6570\u636e\u5e93\u7ea7<\/td>\n<td>\u5e93\u540d.*<\/td>\n<td>\u4e1a\u52a1\u5e93\u5f00\u53d1<\/td>\n<\/tr>\n<tr>\n<td>\u8868\u7ea7<\/td>\n<td>\u5e93\u540d.\u8868\u540d<\/td>\n<td>\u5355\u8868\u64cd\u4f5c<\/td>\n<\/tr>\n<tr>\n<td>\u5217\u7ea7<\/td>\n<td>\u5e93\u540d.\u8868\u540d(\u52171,\u52172)<\/td>\n<td>\u654f\u611f\u5217&#xff08;\u624b\u673a\u53f7\/\u5bc6\u7801&#xff09;\u7ba1\u63a7<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5e38\u7528\u6743\u9650&#xff1a;SELECT\/INSERT\/UPDATE\/DELETE&#xff08;\u589e\u5220\u6539\u67e5&#xff09;\u3001CREATE\/ALTER\/DROP&#xff08;\u7ed3\u6784&#xff09;\u3001ALL PRIVILEGES&#xff08;\u5168\u90e8&#xff09;\u3002<\/p>\n<p><span class=\"token comment\">&#8212; \u4e1a\u52a1\u5e93\u5168\u6743\u9650<\/span><br \/>\n<span class=\"token keyword\">GRANT<\/span> <span class=\"token keyword\">SELECT<\/span><span class=\"token punctuation\">,<\/span><span class=\"token keyword\">INSERT<\/span><span class=\"token punctuation\">,<\/span><span class=\"token keyword\">UPDATE<\/span><span class=\"token punctuation\">,<\/span><span class=\"token keyword\">DELETE<\/span><span class=\"token punctuation\">,<\/span><span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">ON<\/span> inventory<span class=\"token punctuation\">.<\/span><span class=\"token operator\">*<\/span> <span class=\"token keyword\">TO<\/span> hero<span class=\"token variable\">&#064;&#039;%&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">&#8212; \u53ea\u8bfb\u8d26\u53f7&#xff08;\u62a5\u8868\/\u76d1\u63a7&#xff09;<\/span><br \/>\n<span class=\"token keyword\">GRANT<\/span> <span class=\"token keyword\">SELECT<\/span> <span class=\"token keyword\">ON<\/span> inventory<span class=\"token punctuation\">.<\/span><span class=\"token operator\">*<\/span> <span class=\"token keyword\">TO<\/span> <span class=\"token string\">&#039;report&#039;<\/span><span class=\"token variable\">&#064;&#039;%&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">&#8212; \u5168\u5c40\u7ba1\u7406\u5458<\/span><br \/>\n<span class=\"token keyword\">GRANT<\/span> <span class=\"token keyword\">ALL<\/span> <span class=\"token keyword\">PRIVILEGES<\/span> <span class=\"token keyword\">ON<\/span> <span class=\"token operator\">*<\/span><span class=\"token punctuation\">.<\/span><span class=\"token operator\">*<\/span> <span class=\"token keyword\">TO<\/span> <span class=\"token string\">&#039;dba&#039;<\/span><span class=\"token variable\">&#064;&#039;localhost&#039;<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u6388\u6743\u540e\u6267\u884c FLUSH PRIVILEGES; \u8ba9\u6743\u9650\u751f\u6548\u3002<\/p>\n<p>&#x1f4a1; \u6700\u5c0f\u6743\u9650\u539f\u5219&#xff1a;\u53ea\u7ed9&#034;\u521a\u597d\u591f\u7528&#034;\u7684\u6743\u9650&#xff1b;\u751f\u4ea7\u73af\u5883\u907f\u514d &#064;&#039;%&#039;&#xff0c;\u5e94\u9650\u5b9a\u5177\u4f53 IP\/\u7f51\u6bb5\u3002<\/p>\n<h4>2.4 \u67e5\u770b \/ \u56de\u6536 \/ \u5220\u9664 \/ \u6539\u5bc6\u7801<\/h4>\n<p><span class=\"token keyword\">SHOW<\/span> GRANTS <span class=\"token keyword\">FOR<\/span> hero<span class=\"token variable\">&#064;&#039;%&#039;<\/span><span class=\"token punctuation\">;<\/span>                          <span class=\"token comment\">&#8212; \u67e5\u770b\u6743\u9650<\/span><br \/>\n<span class=\"token keyword\">SHOW<\/span> GRANTS<span class=\"token punctuation\">;<\/span>                                       <span class=\"token comment\">&#8212; \u67e5\u770b\u5f53\u524d\u767b\u5f55\u7528\u6237\u6743\u9650<\/span><\/p>\n<p><span class=\"token keyword\">REVOKE<\/span> <span class=\"token keyword\">DELETE<\/span> <span class=\"token keyword\">ON<\/span> inventory<span class=\"token punctuation\">.<\/span><span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> hero<span class=\"token variable\">&#064;&#039;%&#039;<\/span><span class=\"token punctuation\">;<\/span>        <span class=\"token comment\">&#8212; \u56de\u6536\u67d0\u6743\u9650<\/span><br \/>\n<span class=\"token keyword\">DROP<\/span> <span class=\"token keyword\">USER<\/span> hero<span class=\"token variable\">&#064;&#039;%&#039;<\/span><span class=\"token punctuation\">;<\/span>                                <span class=\"token comment\">&#8212; \u5220\u9664\u7528\u6237<\/span><\/p>\n<p><span class=\"token comment\">&#8212; \u6539\u5bc6\u7801<\/span><br \/>\n<span class=\"token keyword\">SET<\/span> PASSWORD <span class=\"token keyword\">FOR<\/span> <span class=\"token string\">&#039;hero&#039;<\/span><span class=\"token variable\">&#064;&#039;%&#039;<\/span> <span class=\"token operator\">&#061;<\/span> PASSWORD<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;\u65b0\u5bc6\u7801&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SET<\/span> PASSWORD <span class=\"token operator\">&#061;<\/span> PASSWORD<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;\u65b0\u5bc6\u7801&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>                 <span class=\"token comment\">&#8212; \u6539\u81ea\u5df1\u7684\u5bc6\u7801<\/span><br \/>\nFLUSH <span class=\"token keyword\">PRIVILEGES<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h4>2.5 \u5e38\u89c1\u8bbf\u95ee\u6545\u969c<\/h4>\n<table>\n<tr>\u73b0\u8c61\u539f\u56e0 \/ \u89e3\u51b3<\/tr>\n<tbody>\n<tr>\n<td>\u53ea\u80fd\u672c\u673a\u8fde&#xff0c;\u8fdc\u7a0b\u8fde\u4e0d\u4e0a<\/td>\n<td>server.cnf \u8bbe\u4e86 skip-networking&#xff1b;\u6216 bind-address \u4e0d\u5bf9&#xff1b;user \u8868\u65e0\u5bf9\u5e94\u4e3b\u673a\u8bb0\u5f55<\/td>\n<\/tr>\n<tr>\n<td>\u80fd\u8fde\u4f46\u53ea\u770b\u5f97\u5230 information_schema<\/td>\n<td>\u6ca1\u7ed9\u8be5\u7528\u6237\u6388\u6743&#xff08;\u65b0\u7528\u6237\u6700\u5c0f\u6743\u9650&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u80fd\u8fde\u4f46\u4e0d\u80fd\u5efa\u5e93<\/td>\n<td>\u9700\u6388\u4e88\u5168\u5c40 CREATE \u6743\u9650<\/td>\n<\/tr>\n<tr>\n<td>\u80fd\u8fde\u4f46\u4e0d\u80fd\u8bfb\u5199\u6570\u636e<\/td>\n<td>\u9700\u6388\u4e88\u5bf9\u5e94\u5e93\u7684 CRUD \u6743\u9650<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u7b2c 3 \u7ae0\u3000\u5907\u4efd\u548c\u6062\u590d<\/h3>\n<p>\u3010\u4f7f\u7528\u9891\u7387&#xff1a;\u9ad8\u3011\u5907\u4efd\u662f\u8fd0\u7ef4\u4fdd\u547d\u624b\u6bb5\u3002<\/p>\n<h4>3.1 \u2b50 \u903b\u8f91\u5907\u4efd vs \u7269\u7406\u5907\u4efd<\/h4>\n<table>\n<tr>\u5bf9\u6bd4\u903b\u8f91\u5907\u4efd\u7269\u7406\u5907\u4efd<\/tr>\n<tbody>\n<tr>\n<td>\u5185\u5bb9<\/td>\n<td>\u5bfc\u51fa\u4e3a\u53ef\u91cd\u5efa\u6570\u636e\u5e93\u7684 SQL \u6587\u672c<\/td>\n<td>\u76f4\u63a5\u590d\u5236\u6570\u636e\u5e93\u76ee\u5f55\/\u6587\u4ef6<\/td>\n<\/tr>\n<tr>\n<td>\u901f\u5ea6<\/td>\n<td>\u6162&#xff08;\u8981\u8f6c\u6362\u683c\u5f0f&#xff09;<\/td>\n<td>\u5feb&#xff08;\u76f4\u63a5\u62f7\u6587\u4ef6&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u53ef\u79fb\u690d\u6027<\/td>\n<td>\u9ad8&#xff0c;\u751a\u81f3\u53ef\u5bfc\u5165\u5176\u4ed6\u6570\u636e\u5e93<\/td>\n<td>\u5dee&#xff0c;\u9700\u76f8\u540c\u8f6f\u786c\u4ef6\u73af\u5883<\/td>\n<\/tr>\n<tr>\n<td>\u6267\u884c\u65f6\u673a<\/td>\n<td>\u670d\u52a1\u5728\u7ebf\u5373\u53ef<\/td>\n<td>\u901a\u5e38\u9700\u505c\u670d\u6216\u9501\u8868<\/td>\n<\/tr>\n<tr>\n<td>\u662f\u5426\u542b\u65e5\u5fd7\/\u914d\u7f6e<\/td>\n<td>\u4e0d\u542b<\/td>\n<td>\u53ef\u5305\u542b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>3.2 \u7269\u7406\u5907\u4efd \/ \u6062\u590d<\/h4>\n<p>systemctl stop mariadb<br \/>\n<span class=\"token function\">cp<\/span> <span class=\"token parameter variable\">-a<\/span> \/var\/lib\/mysql \/backup\/mysql          <span class=\"token comment\"># \u5907\u4efd&#xff08;-a \u4fdd\u7559\u5c5e\u6027&#xff09;<\/span><\/p>\n<p><span class=\"token comment\"># \u6062\u590d<\/span><br \/>\nsystemctl stop mariadb<br \/>\n<span class=\"token function\">rm<\/span> <span class=\"token parameter variable\">-fr<\/span> \/var\/lib\/mysql<br \/>\n<span class=\"token function\">cp<\/span> <span class=\"token parameter variable\">-a<\/span> \/backup\/mysql \/var\/lib\/mysql<br \/>\n<span class=\"token function\">chown<\/span> <span class=\"token parameter variable\">-R<\/span> mysql:mysql \/var\/lib\/mysql         <span class=\"token comment\"># \u5173\u952e&#xff1a;\u6062\u590d\u5c5e\u4e3b<\/span><br \/>\nsystemctl start mariadb<\/p>\n<h4>3.3 \u903b\u8f91\u5907\u4efd mysqldump&#xff08;\u2b50 \u6700\u5e38\u7528&#xff09;<\/h4>\n<p><span class=\"token comment\"># \u65b9\u5f0f1&#xff1a;\u53ea\u5907\u4efd\u6570\u636e\/\u8868&#xff08;\u4e0d\u542b\u5efa\u5e93\u8bed\u53e5&#xff09;<\/span><br \/>\nmysqldump <span class=\"token parameter variable\">-u<\/span> root <span class=\"token parameter variable\">-p<\/span> inventory <span class=\"token operator\">&gt;<\/span> \/backup\/inventory-1.sql<br \/>\n<span class=\"token comment\"># \u65b9\u5f0f2&#xff1a;\u542b CREATE DATABASE \/ USE&#xff08;\u63a8\u8350&#xff0c;\u6062\u590d\u6700\u7701\u4e8b&#xff09;<\/span><br \/>\nmysqldump <span class=\"token parameter variable\">-u<\/span> root <span class=\"token parameter variable\">-p<\/span> <span class=\"token parameter variable\">&#8211;databases<\/span> inventory <span class=\"token operator\">&gt;<\/span> \/backup\/inventory-2.sql<br \/>\n<span class=\"token comment\"># \u65b9\u5f0f3&#xff1a;\u5907\u4efd\u6240\u6709\u6570\u636e\u5e93<\/span><br \/>\nmysqldump <span class=\"token parameter variable\">-u<\/span> root <span class=\"token parameter variable\">-p<\/span> &#8211;all-databases <span class=\"token operator\">&gt;<\/span> \/backup\/all.sql<\/p>\n<p>\u6062\u590d&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u65b9\u5f0f2 \u7684\u6587\u4ef6&#xff08;\u81ea\u5e26\u5efa\u5e93&#xff09;&#xff0c;\u76f4\u63a5\u5bfc\u5165<\/span><br \/>\nmysql <span class=\"token parameter variable\">-u<\/span> root <span class=\"token parameter variable\">-p<\/span> <span class=\"token operator\">&lt;<\/span> \/backup\/inventory-2.sql<br \/>\n<span class=\"token comment\"># \u65b9\u5f0f1 \u7684\u6587\u4ef6&#xff0c;\u9700\u5148\u5efa\u5e93\u518d\u6307\u5b9a\u5e93\u5bfc\u5165<\/span><br \/>\nmysql <span class=\"token parameter variable\">-u<\/span> root <span class=\"token parameter variable\">-p<\/span> <span class=\"token parameter variable\">-e<\/span> <span class=\"token string\">&#039;create database inventory;&#039;<\/span><br \/>\nmysql <span class=\"token parameter variable\">-u<\/span> root <span class=\"token parameter variable\">-p<\/span> inventory <span class=\"token operator\">&lt;<\/span> \/backup\/inventory-1.sql<\/p>\n<p>\u5728 mysql \u547d\u4ee4\u884c\u5185\u4e5f\u53ef\u7528 source \/backup\/xxx.sql; \u6267\u884c\u6062\u590d\u3002 &#x1f53a; \u8fd8\u539f\u4f1a\u7528\u5907\u4efd\u5185\u5bb9\u8986\u76d6\u73b0\u6709\u6570\u636e&#xff0c;\u6bd4\u5907\u4efd\u65b0\u7684\u6570\u636e\u4f1a\u4e22\u5931\u3002<\/p>\n<hr \/>\n<h3>\u7b2c 4 \u7ae0\u3000\u4e3b\u4ece\u540c\u6b65<\/h3>\n<p>\u3010\u4f7f\u7528\u9891\u7387&#xff1a;\u9ad8\u3011\u4e3b\u4ece\u590d\u5236\u7528\u4e8e\u8bfb\u5199\u5206\u79bb\u3001\u5907\u4efd\u3001\u9ad8\u53ef\u7528&#xff0c;\u662f\u6570\u636e\u5e93\u6269\u5c55\u7684\u57fa\u7840\u3002<\/p>\n<h4>4.1 \u2b50 \u540c\u6b65\u539f\u7406&#xff08;&#x1f53a; \u6838\u5fc3&#xff0c;\u52a1\u5fc5\u7406\u89e3&#xff09;<\/h4>\n<p>\u672c\u8d28&#xff1a;\u4e3b\u5e93\u628a\u6570\u636e\u53d8\u66f4\u5199\u8fdb binlog&#xff0c;\u4ece\u5e93\u62c9\u53d6\u5e76\u91cd\u653e\u3002\u6d89\u53ca\u4e24\u4e2a\u65e5\u5fd7\u3001\u4e24\u4e2a\u7ebf\u7a0b&#xff1a;<\/p>\n<p>\u4e3b\u5e93 Master&#xff1a;\u5199\u64cd\u4f5c \u2192 \u8bb0\u5f55\u5230 \u4e8c\u8fdb\u5236\u65e5\u5fd7 binlog<br \/>\n        \u2502<br \/>\n        \u2502  \u4ece\u5e93 IO \u7ebf\u7a0b\u4e3b\u52a8\u8fde\u63a5\u4e3b\u5e93\u3001\u62c9\u53d6 binlog<br \/>\n        \u25bc<br \/>\n\u4ece\u5e93 Slave&#xff1a;IO \u7ebf\u7a0b\u628a\u5185\u5bb9\u5199\u5165 \u4e2d\u7ee7\u65e5\u5fd7 relay log<br \/>\n        \u2502<br \/>\n        \u2502  SQL \u7ebf\u7a0b\u8bfb\u53d6 relay log&#xff0c;\u9010\u6761\u91cd\u653e<br \/>\n        \u25bc<br \/>\n\u4ece\u5e93\u6570\u636e\u4e0e\u4e3b\u5e93\u6700\u7ec8\u4e00\u81f4<\/p>\n<table>\n<tr>\u89d2\u8272\u540d\u79f0\u804c\u8d23<\/tr>\n<tbody>\n<tr>\n<td>\u4e3b\u5e93<\/td>\n<td>binlog<\/td>\n<td>\u8bb0\u5f55\u6240\u6709\u6570\u636e\u53d8\u66f4<\/td>\n<\/tr>\n<tr>\n<td>\u4ece\u5e93 IO \u7ebf\u7a0b<\/td>\n<td>Slave_IO_Running<\/td>\n<td>\u62c9\u4e3b\u5e93 binlog&#xff0c;\u5199\u5165 relay log<\/td>\n<\/tr>\n<tr>\n<td>\u4ece\u5e93 SQL \u7ebf\u7a0b<\/td>\n<td>Slave_SQL_Running<\/td>\n<td>\u8bfb relay log \u5e76\u91cd\u653e SQL<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f4a1; \u4e3b\u5e93\u5199\u5b8c binlog \u5c31\u7acb\u5373\u56de\u590d\u5ba2\u6237\u7aef&#xff08;\u4e0d\u7b49\u4ece\u5e93&#xff09;&#xff0c;\u8fd9\u662f&#034;\u5f02\u6b65&#034;\u7279\u5f81\u3002<\/p>\n<h4>4.2 \u5e38\u89c1\u67b6\u6784<\/h4>\n<ul>\n<li>\u4e00\u4e3b\u4e00\u4ece \/ \u4e00\u4e3b\u591a\u4ece&#xff1a;\u4e3b\u5199\u4ece\u8bfb&#xff0c;\u591a\u4ece\u53ef\u5206\u62c5\u8bfb\u538b\u529b&#xff08;\u8bfb\u5199\u5206\u79bb&#xff09;&#xff1b;<\/li>\n<li>\u7ea7\u8054\u590d\u5236&#xff1a;\u4e3b\u2192\u4ece1\u2192\u4ece2&#xff0c;\u51cf\u8f7b\u4e3b\u5e93\u590d\u5236\u538b\u529b&#xff1b;<\/li>\n<li>\u53cc\u4e3b\u590d\u5236&#xff1a;\u4e92\u4e3a\u4e3b\u4ece&#xff0c;\u591a\u7528\u4e8e\u9ad8\u53ef\u7528\u5207\u6362&#xff0c;\u4e00\u822c\u4e0d\u53cc\u5199&#xff08;\u6613\u51b2\u7a81&#xff09;\u3002<\/li>\n<\/ul>\n<h4>4.3 \u4e09\u79cd\u590d\u5236\u65b9\u5f0f<\/h4>\n<table>\n<tr>\u65b9\u5f0f\u539f\u7406\u7279\u70b9<\/tr>\n<tbody>\n<tr>\n<td>\u5f02\u6b65&#xff08;\u9ed8\u8ba4&#xff09;<\/td>\n<td>\u4e3b\u5e93\u5199\u5b8c\u5373\u56de\u590d&#xff0c;\u4e0d\u7b49\u4ece\u5e93<\/td>\n<td>\u6027\u80fd\u6700\u597d&#xff0c;\u5b95\u673a\u53ef\u80fd\u4e22\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td>\u534a\u540c\u6b65<\/td>\n<td>\u4e3b\u5e93\u7b49\u81f3\u5c11\u4e00\u4e2a\u4ece\u5e93\u786e\u8ba4\u6536\u5230 binlog \u518d\u56de\u590d&#xff1b;\u8d85\u65f6\u964d\u7ea7\u5f02\u6b65<\/td>\n<td>\u4e00\u81f4\u6027\u66f4\u597d&#xff0c;\u6027\u80fd\u7565\u635f<\/td>\n<\/tr>\n<tr>\n<td>\u5168\u540c\u6b65<\/td>\n<td>\u7b49\u6240\u6709\u4ece\u5e93\u6267\u884c\u5b8c\u624d\u56de\u590d<\/td>\n<td>\u4e00\u81f4\u6027\u6700\u9ad8\u3001\u6027\u80fd\u6700\u5dee&#xff08;\u9700 MGR \u7b49\u5b9e\u73b0&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>4.4 \u4e3b\u4ece\u5ef6\u8fdf<\/h4>\n<ul>\n<li>\u5ef6\u8fdf\u6ca1\u6709\u56fa\u5b9a\u503c&#xff0c;\u53d6\u51b3\u4e8e\u4ece\u5e93&#034;\u62c9\u53d6&#043;\u6267\u884c&#034;\u901f\u5ea6&#xff1b;<\/li>\n<li>\u5f71\u54cd\u56e0\u7d20&#xff1a;\u7f51\u7edc&#xff08;\u8de8\u673a\u623f\u6162&#xff09;\u3001\u4e3b\u5e93\u5927\u4e8b\u52a1\/\u9ad8\u5199\u5165\u3001\u4ece\u5e93\u786c\u4ef6\u5dee\u3001SQL \u7ebf\u7a0b\u5355\u7ebf\u7a0b&#xff1b;<\/li>\n<li>\u76d1\u63a7&#xff1a;\u4ece\u5e93 SHOW SLAVE STATUS\\\\G; \u4e2d Seconds_Behind_Master \u5373\u843d\u540e\u79d2\u6570&#xff1b;<\/li>\n<li>\u4f18\u5316&#xff1a;\u63d0\u5347\u4ece\u5e93\u914d\u7f6e\u3001\u5f00\u542f\u5e76\u884c\u590d\u5236&#xff08;slave_parallel_workers&#xff09;\u3001\u62c6\u5206\u5927\u4e8b\u52a1\u3001\u7ea7\u8054\u590d\u5236\u3002<\/li>\n<\/ul>\n<h4>4.5 \u2b50 \u4e3b\u4ece\u540c\u6b65\u5b9e\u8df5&#xff08;db1 &#061; 10.1.8.13 \u4e3b&#xff0c;db2 &#061; 10.1.8.14 \u4ece&#xff09;<\/h4>\n<p>\u2460 \u914d\u7f6e\u4e3b\u5e93 db1&#xff1a;<\/p>\n<p><span class=\"token function\">cat<\/span> <span class=\"token operator\">&gt;<\/span> \/etc\/my.cnf.d\/master.cnf <span class=\"token operator\">&lt;&lt;<\/span><span class=\"token string\">&#039;EOF&#039;<br \/>\n[mysqld]<br \/>\nserver_id &#061; 1<br \/>\nlog_bin &#061; mysql-bin<br \/>\nbinlog_format &#061; ROW<br \/>\nrelay_log &#061; mysql-relay-bin<br \/>\nbinlog-ignore-db &#061; information_schema<br \/>\nbinlog-ignore-db &#061; performance_schema<br \/>\nEOF<\/span><br \/>\nsystemctl restart mariadb<\/p>\n<p>\u2461 \u914d\u7f6e\u4ece\u5e93 db2&#xff1a;<\/p>\n<p><span class=\"token function\">cat<\/span> <span class=\"token operator\">&gt;<\/span> \/etc\/my.cnf.d\/master.cnf <span class=\"token operator\">&lt;&lt;<\/span><span class=\"token string\">&#039;EOF&#039;<br \/>\n[mysqld]<br \/>\nserver_id &#061; 2<br \/>\nlog_bin &#061; mysql-bin<br \/>\nbinlog_format &#061; ROW<br \/>\nrelay_log &#061; mysql-relay-bin<br \/>\nbinlog-ignore-db &#061; information_schema<br \/>\nbinlog-ignore-db &#061; performance_schema<br \/>\nEOF<\/span><br \/>\nsystemctl restart mariadb<\/p>\n<p>\u2462 \u4e3b\u5e93\u5efa\u7acb\u590d\u5236\u8d26\u53f7\u3001\u67e5\u770b\u4f4d\u70b9&#xff1a;<\/p>\n<p><span class=\"token comment\">&#8212; \u5728 db1&#xff08;10.1.8.13&#xff09;\u6267\u884c<\/span><br \/>\nmysql <span class=\"token operator\">&#8211;<\/span>uroot <span class=\"token operator\">&#8211;<\/span>p123<br \/>\n<span class=\"token keyword\">GRANT<\/span> <span class=\"token keyword\">REPLICATION<\/span> SLAVE<span class=\"token punctuation\">,<\/span> <span class=\"token keyword\">REPLICATION<\/span> CLIENT <span class=\"token keyword\">ON<\/span> <span class=\"token operator\">*<\/span><span class=\"token punctuation\">.<\/span><span class=\"token operator\">*<\/span><br \/>\n  <span class=\"token keyword\">TO<\/span> <span class=\"token string\">&#039;repl&#039;<\/span><span class=\"token variable\">&#064;&#039;10.1.8.14&#039;<\/span> IDENTIFIED <span class=\"token keyword\">BY<\/span> <span class=\"token string\">&#039;123&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\nFLUSH <span class=\"token keyword\">PRIVILEGES<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SHOW<\/span> MASTER <span class=\"token keyword\">STATUS<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">&#8212; \u8bb0\u4e0b File&#xff08;\u5982 mysql-bin.000003&#xff09;\u548c Position&#xff08;\u5982 327&#xff09;<\/span><\/p>\n<p>\u2463 \u4ece\u5e93\u6307\u5411\u4e3b\u5e93\u5e76\u542f\u52a8&#xff1a;<\/p>\n<p><span class=\"token comment\">&#8212; \u5728 db2&#xff08;10.1.8.14&#xff09;\u6267\u884c<\/span><br \/>\nmysql <span class=\"token operator\">&#8211;<\/span>uroot <span class=\"token operator\">&#8211;<\/span>p123<br \/>\nCHANGE MASTER <span class=\"token keyword\">TO<\/span><br \/>\n  master_host<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;10.1.8.13&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  master_user<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;repl&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  master_password<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;123&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  master_port<span class=\"token operator\">&#061;<\/span><span class=\"token number\">3306<\/span><span class=\"token punctuation\">,<\/span><br \/>\n<span class=\"token comment\">&#8212; \u4e0e\u4e3b\u8282\u70b9 SHOW MASTER STATUS \u67e5\u5230\u7684\u5bf9\u5e94<\/span><br \/>\n  master_log_file<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;mysql-bin.000003&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  master_log_pos<span class=\"token operator\">&#061;<\/span><span class=\"token number\">327<\/span><span class=\"token punctuation\">,<\/span><br \/>\n  master_connect_retry<span class=\"token operator\">&#061;<\/span><span class=\"token number\">30<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">START<\/span> SLAVE<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SHOW<\/span> SLAVE <span class=\"token keyword\">STATUS<\/span>\\\\G<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token comment\">&#8212; \u786e\u8ba4\u4e24\u9879\u90fd\u4e3a Yes&#xff1a;<\/span><br \/>\n<span class=\"token comment\">&#8212; Slave_IO_Running: Yes<\/span><br \/>\n<span class=\"token comment\">&#8212; Slave_SQL_Running: Yes<\/span><\/p>\n<p>\u2464 \u9a8c\u8bc1\u540c\u6b65&#xff1a;<\/p>\n<p><span class=\"token comment\">&#8212; \u4e3b\u5e93 db1 \u5efa\u5e93\u5efa\u8868\u63d2\u6570\u636e<\/span><br \/>\n<span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">DATABASE<\/span> test<span class=\"token punctuation\">;<\/span> <span class=\"token keyword\">USE<\/span> test<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">TABLE<\/span> linux<span class=\"token punctuation\">(<\/span>username <span class=\"token keyword\">varchar<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">15<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> password <span class=\"token keyword\">varchar<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">15<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">INSERT<\/span> <span class=\"token keyword\">INTO<\/span> linux <span class=\"token keyword\">VALUES<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;hero1&#039;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token string\">&#039;123&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;hero2&#039;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token string\">&#039;123&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;hero3&#039;<\/span><span class=\"token punctuation\">,<\/span><span class=\"token string\">&#039;123&#039;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token comment\">&#8212; \u4ece\u5e93 db2 \u67e5\u8be2&#xff0c;\u80fd\u770b\u5230\u5373\u540c\u6b65\u6210\u529f<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> <span class=\"token operator\">*<\/span> <span class=\"token keyword\">FROM<\/span> test<span class=\"token punctuation\">.<\/span>linux<span class=\"token punctuation\">;<\/span><\/p>\n<p>&#x1f53a; \u914d\u7f6e\u8981\u70b9&#xff1a;\u4e24\u5e93 server_id \u4e0d\u80fd\u91cd\u590d&#xff1b;\u4ece\u5e93 CHANGE MASTER \u91cc\u7684\u6587\u4ef6\u540d\u548c\u4f4d\u70b9\u5fc5\u987b\u6765\u81ea\u4e3b\u5e93 SHOW MASTER STATUS \u7684\u771f\u5b9e\u503c\u3002<\/p>\n<h4>4.6 \u9632\u6b62\u6570\u636e\u4e22\u5931\u7684\u5173\u952e\u53c2\u6570<\/h4>\n<ul>\n<li>\u534a\u540c\u6b65\u590d\u5236&#xff1b;<\/li>\n<li>sync_binlog&#061;1&#xff1a;\u6bcf\u6b21\u4e8b\u52a1\u628a binlog \u5237\u76d8&#xff1b;<\/li>\n<li>innodb_flush_log_at_trx_commit&#061;1&#xff1a;\u4e8b\u52a1\u63d0\u4ea4\u7acb\u5373\u5237 redo log\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>\u7b2c 5 \u7ae0\u3000\u5e94\u6025\u573a\u666f&#xff08;&#x1f53a; \u6551\u547d&#xff09;<\/h3>\n<p>\u5171\u540c\u601d\u8def&#xff1a;\u7ed5\u8fc7\u6743\u9650\u9a8c\u8bc1\u542f\u52a8 \u2192 \u6539\u6743\u9650\u8868 \u2192 \u6062\u590d\u6b63\u5e38\u542f\u52a8\u3002<\/p>\n<h4>5.1 \u5fd8\u8bb0 root \u5bc6\u7801<\/h4>\n<li>\/etc\/my.cnf.d\/server.cnf \u7684 [mysqld] \u4e0b\u52a0 skip-grant-tables&#061;1&#xff1b;<\/li>\n<li>\u91cd\u542f mariadb&#xff1b;<\/li>\n<li>mysql -u root \u514d\u5bc6\u8fdb\u5165&#xff0c;\u6267\u884c&#xff1a;<span class=\"token keyword\">UPDATE<\/span> mysql<span class=\"token punctuation\">.<\/span><span class=\"token keyword\">user<\/span> <span class=\"token keyword\">SET<\/span> password<span class=\"token operator\">&#061;<\/span>PASSWORD<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;123&#039;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">WHERE<\/span> <span class=\"token keyword\">User<\/span><span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;root&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\nFLUSH <span class=\"token keyword\">PRIVILEGES<\/span><span class=\"token punctuation\">;<\/span>\n <\/li>\n<li>\u53bb\u6389 skip-grant-tables&#xff0c;\u91cd\u542f\u670d\u52a1\u3002<\/li>\n<h4>5.2 root \u6743\u9650\u88ab\u8bef\u56de\u6536<\/h4>\n<ul>\n<li>\u540c\u6837 skip-grant-tables \u542f\u52a8\u540e&#xff1a;\n<ul>\n<li>\u8001\u7248\u672c&#xff1a;UPDATE mysql.user SET \u5404\u6743\u9650\u5217&#061;&#039;Y&#039; WHERE User&#061;&#039;root&#039;; FLUSH PRIVILEGES;<\/li>\n<li>\u65b0\u7248\u672c&#xff1a;FLUSH PRIVILEGES; GRANT ALL PRIVILEGES ON *.* TO &#039;root&#039;&#064;&#039;localhost&#039; WITH GRANT OPTION;<\/li>\n<\/ul>\n<\/li>\n<li>\u91cd\u542f\u6062\u590d\u3002<\/li>\n<\/ul>\n<h4>5.3 root \u8d26\u53f7\u88ab\u8bef\u5220\u9664<\/h4>\n<ul>\n<li>skip-grant-tables \u542f\u52a8\u540e&#xff1a;\n<ul>\n<li>\u8001\u7248\u672c&#xff1a;\u5411 mysql.user \u63d2\u5165 root \u884c&#xff08;\u5404\u6743\u9650\u5217\u8bbe Y&#xff09;&#xff1b;<\/li>\n<li>\u65b0\u7248\u672c&#xff1a;CREATE USER &#039;root&#039;&#064;&#039;localhost&#039; IDENTIFIED BY &#039;123&#039;; GRANT ALL PRIVILEGES ON *.* TO &#039;root&#039;&#064;&#039;localhost&#039; WITH GRANT OPTION;<\/li>\n<\/ul>\n<\/li>\n<li>FLUSH PRIVILEGES; \u540e\u91cd\u542f\u3002<\/li>\n<\/ul>\n<hr \/>\n<h2>\u7b2c\u4e8c\u7bc7\u3000Nginx \u670d\u52a1\u5668<\/h2>\n<h3>\u7b2c 6 \u7ae0\u3000Nginx \u4ecb\u7ecd<\/h3>\n<p>\u3010\u4f7f\u7528\u9891\u7387&#xff1a;\u6781\u9ad8\u3011\u5f53\u4eca\u6700\u4e3b\u6d41\u7684 Web \u670d\u52a1\u5668 \/ \u53cd\u5411\u4ee3\u7406 \/ \u8d1f\u8f7d\u5747\u8861\u5668\u3002<\/p>\n<p>Nginx&#xff08;engine x&#xff09;\u662f\u4e00\u6b3e\u9ad8\u6027\u80fd\u7684 HTTP \u670d\u52a1\u5668\u548c\u53cd\u5411\u4ee3\u7406\u670d\u52a1\u5668&#xff1a;\u9ad8\u5e76\u53d1\u4e0b\u53ef\u652f\u6491\u7ea6 5 \u4e07\u5e76\u53d1\u8fde\u63a5&#xff0c;\u800c\u5185\u5b58\u3001CPU \u6d88\u8017\u5f88\u4f4e\u3001\u8fd0\u884c\u7a33\u5b9a\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010094905-6aca0a11bca1d.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<ul>\n<li>\u5178\u578b\u4f4d\u7f6e&#xff1a;\u7528\u6237\u6d4f\u89c8\u5668 \u2192 Nginx&#xff08;\u7edf\u4e00\u5165\u53e3&#xff09; \u2192 \u540e\u7aef Tomcat \/ Apache \/ \u5e94\u7528\u670d\u52a1\u5668&#xff1b;<\/li>\n<li>\u9759\u6001\u8d44\u6e90\u53ef\u7f13\u5b58\u5230\u6d4f\u89c8\u5668&#xff0c;\u4e0a\u6e38\u54cd\u5e94\u53ef\u7f13\u5b58\u5230 Nginx&#xff0c;\u8fdb\u4e00\u6b65\u63d0\u901f\u3001\u51cf\u538b\u3002<\/li>\n<\/ul>\n<p>&#x1f4a1; Nginx \u5e38\u89c1\u56db\u5927\u89d2\u8272&#xff1a;\u2460 Web \u670d\u52a1\u5668&#xff08;\u63d0\u4f9b\u9759\u6001\u7f51\u9875&#xff09;&#xff1b;\u2461 \u53cd\u5411\u4ee3\u7406&#xff1b;\u2462 \u8d1f\u8f7d\u5747\u8861&#xff1b;\u2463 \u7f13\u5b58\u3002<\/p>\n<h3>\u7b2c 7 \u7ae0\u3000Nginx \u90e8\u7f72<\/h3>\n<p><span class=\"token comment\"># \u5b89\u88c5\u3001\u542f\u52a8<\/span><br \/>\nyum <span class=\"token parameter variable\">-y<\/span> <span class=\"token function\">install<\/span> nginx<br \/>\nsystemctl <span class=\"token builtin class-name\">enable<\/span> nginx <span class=\"token parameter variable\">&#8211;now<\/span><\/p>\n<p><span class=\"token comment\"># \u51c6\u5907\u4e3b\u9875&#xff08;\u5907\u4efd\u539f\u9996\u9875&#xff0c;\u5199\u5165\u65b0\u5185\u5bb9&#xff09;<\/span><br \/>\n<span class=\"token function\">mv<\/span> \/usr\/share\/nginx\/html\/index.html<span class=\"token punctuation\">{<\/span>,.ori<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> Hello World From Nginx <span class=\"token operator\">&gt;<\/span> \/usr\/share\/nginx\/html\/index.html<\/p>\n<p><span class=\"token comment\"># \u9632\u706b\u5899\u653e\u884c HTTP<\/span><br \/>\nfirewall-cmd &#8211;add-service<span class=\"token operator\">&#061;<\/span>http <span class=\"token parameter variable\">&#8211;permanent<\/span><br \/>\nfirewall-cmd <span class=\"token parameter variable\">&#8211;reload<\/span><\/p>\n<p>\u7528\u57df\u540d\u8bbf\u95ee&#xff08;\u914d\u7f6e hosts \u89e3\u6790&#xff09;&#xff1a;<\/p>\n<p># Linux \/ Unix \u6539 \/etc\/hosts&#xff1b;Windows \u6539 C:\\\\Windows\\\\System32\\\\drivers\\\\etc\\\\hosts<br \/>\n10.1.8.11 www.hero.cloud<\/p>\n<p>\u4e4b\u540e curl http:\/\/www.hero.cloud \u5373\u53ef\u8bbf\u95ee\u3002<\/p>\n<h3>\u7b2c 8 \u7ae0\u3000Nginx \u914d\u7f6e\u7ed3\u6784&#xff08;\u2b50 \u5c42\u7ea7\u5316&#xff09;<\/h3>\n<p>\u6574\u4f53\u662f\u5d4c\u5957\u7ed3\u6784&#xff1a;\u5168\u5c40\u5757 \u2192 events \u5757 \u2192 http \u5757 \u2192 server \u5757 \u2192 location \u5757\u3002<\/p>\n<table>\n<tr>\u5c42\u7ea7\u4f5c\u7528\u5173\u952e\u6307\u4ee4<\/tr>\n<tbody>\n<tr>\n<td>\u5168\u5c40\u5757<\/td>\n<td>\u6574\u4e2a\u8fdb\u7a0b\u7684\u57fa\u7840\u8bbe\u7f6e<\/td>\n<td>user\u3001worker_processes\u3001error_log\u3001pid<\/td>\n<\/tr>\n<tr>\n<td>events \u5757<\/td>\n<td>\u7f51\u7edc\u8fde\u63a5\u6a21\u578b<\/td>\n<td>worker_connections\u3001use epoll<\/td>\n<\/tr>\n<tr>\n<td>http \u5757<\/td>\n<td>\u6240\u6709 HTTP \u670d\u52a1\u516c\u5171\u914d\u7f6e<\/td>\n<td>include mime.types\u3001log_format\u3001sendfile\u3001keepalive<\/td>\n<\/tr>\n<tr>\n<td>server \u5757<\/td>\n<td>\u4e00\u4e2a\u865a\u62df\u4e3b\u673a<\/td>\n<td>listen\u3001server_name\u3001root<\/td>\n<\/tr>\n<tr>\n<td>location \u5757<\/td>\n<td>URL \u8def\u5f84\u5339\u914d\u89c4\u5219<\/td>\n<td>index\u3001try_files\u3001proxy_pass<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p># \u5168\u5c40<br \/>\nuser nginx;<br \/>\nworker_processes auto;          # \u5de5\u4f5c\u8fdb\u7a0b\u6570&#xff0c;auto&#061;\u6309 CPU \u6838\u6570<\/p>\n<p># events<br \/>\nevents {<br \/>\n    worker_connections 1024;    # \u6bcf\u4e2a\u5de5\u4f5c\u8fdb\u7a0b\u6700\u5927\u8fde\u63a5\u6570<br \/>\n    use epoll;                  # Linux \u9ad8\u6027\u80fd\u4e8b\u4ef6\u6a21\u578b<br \/>\n}<\/p>\n<p># http<br \/>\nhttp {<br \/>\n    include       \/etc\/nginx\/mime.types;<br \/>\n    default_type  application\/octet-stream;<br \/>\n    sendfile      on;<br \/>\n    keepalive_timeout 65;<\/p>\n<p>    server {<br \/>\n        listen       80;<br \/>\n        server_name  localhost;<br \/>\n        root         \/usr\/share\/nginx\/html;<\/p>\n<p>        location \/ {<br \/>\n            index index.html index.htm;<br \/>\n        }<br \/>\n        error_page 500 502 503 504 \/50x.html;<br \/>\n    }<br \/>\n}<\/p>\n<p>&#x1f4a1; \u5e76\u53d1\u80fd\u529b\u600e\u4e48\u7b97&#xff1a;\u6700\u5927\u8fde\u63a5\u6570 \u2248 worker_processes \u00d7 worker_connections\u3002 HTTPS \u5728 server \u5757\u52a0 listen 443 ssl; \u5e76\u914d\u7f6e ssl_certificate&#xff08;\u516c\u94a5&#xff09;\u3001ssl_certificate_key&#xff08;\u79c1\u94a5&#xff09;\u3002<\/p>\n<h3>\u7b2c 9 \u7ae0\u3000nginx.conf \u8be6\u89e3\u8981\u70b9<\/h3>\n<p>\u4e3b\u914d\u7f6e\u6587\u4ef6 \/etc\/nginx\/nginx.conf&#xff0c;\u91cd\u70b9\u6307\u4ee4&#xff1a;<\/p>\n<table>\n<tr>\u6307\u4ee4\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>user nginx<\/td>\n<td>\u5de5\u4f5c\u8fdb\u7a0b\u8fd0\u884c\u7528\u6237<\/td>\n<\/tr>\n<tr>\n<td>worker_processes auto<\/td>\n<td>\u5de5\u4f5c\u8fdb\u7a0b\u6570&#xff08;\u5efa\u8bae&#061;CPU \u6838\u6570&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>log_format \/ access_log<\/td>\n<td>\u65e5\u5fd7\u683c\u5f0f \/ \u8bbf\u95ee\u65e5\u5fd7<\/td>\n<\/tr>\n<tr>\n<td>sendfile on<\/td>\n<td>\u9ad8\u6548\u6587\u4ef6\u4f20\u8f93&#xff08;\u96f6\u62f7\u8d1d&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>tcp_nopush \/ tcp_nodelay<\/td>\n<td>\u4f18\u5316\u6570\u636e\u5305\u53d1\u9001\u3001\u964d\u4f4e\u5ef6\u8fdf<\/td>\n<\/tr>\n<tr>\n<td>keepalive_timeout 65<\/td>\n<td>\u957f\u8fde\u63a5\u4fdd\u6301\u65f6\u95f4<\/td>\n<\/tr>\n<tr>\n<td>include \/etc\/nginx\/conf.d\/*.conf<\/td>\n<td>\u52a0\u8f7d\u5b50\u914d\u7f6e&#xff08;\u865a\u62df\u4e3b\u673a\u901a\u5e38\u5199\u8fd9\u91cc&#xff09;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&#x1f4a1; \u751f\u4ea7\u4e2d\u4e60\u60ef\u628a\u6bcf\u4e2a\u7ad9\u70b9\u5199\u6210 \/etc\/nginx\/conf.d\/xxx.conf&#xff0c;\u4e3b\u914d\u7f6e\u53ea\u4fdd\u7559\u5168\u5c40\u8bbe\u7f6e&#xff0c;\u4fbf\u4e8e\u7ba1\u7406\u3002<\/p>\n<h3>\u7b2c 10 \u7ae0\u3000\u914d\u7f6e\u52a0\u8f7d\u4e0e location \u5339\u914d&#xff08;&#x1f53a;&#xff09;<\/h3>\n<ul>\n<li>include \u53ef\u5f15\u5165\u5916\u90e8\u914d\u7f6e&#xff0c;\u5b9e\u73b0\u6a21\u5757\u5316&#xff1b;<\/li>\n<li>\u4f18\u5148\u7ea7&#xff1a;\u5b50\u7ea7\u8986\u76d6\u7236\u7ea7&#xff1b;\u540c\u5c42\u540e\u5b9a\u4e49\u8986\u76d6\u5148\u5b9a\u4e49&#xff1b;<\/li>\n<li>location \u5339\u914d\u4f18\u5148\u7ea7&#xff08;\u9ad8\u2192\u4f4e&#xff09;&#xff1a;\n<li>\u7cbe\u786e\u5339\u914d &#061;<\/li>\n<li>\u524d\u7f00\u5339\u914d ^~<\/li>\n<li>\u6b63\u5219\u5339\u914d ~&#xff08;\u533a\u5206\u5927\u5c0f\u5199&#xff09;\/ ~*&#xff08;\u4e0d\u533a\u5206&#xff09;<\/li>\n<li>\u666e\u901a\u524d\u7f00\u5339\u914d<\/li>\n<\/li>\n<li>\u4fee\u6539\u914d\u7f6e\u540e\u5148\u6d4b\u8bd5\u518d\u91cd\u8f7d&#xff1a;nginx <span class=\"token parameter variable\">-t<\/span>                  <span class=\"token comment\"># \u68c0\u67e5\u8bed\u6cd5&#xff08;\u2b50\u5fc5\u505a&#xff09;<\/span><br \/>\nsystemctl reload nginx    <span class=\"token comment\"># \u5e73\u6ed1\u91cd\u8f7d&#xff0c;\u4e0d\u65ad\u8fde\u63a5<\/span>\n <\/li>\n<\/ul>\n<h3>\u7b2c 11 \u7ae0\u3000\u865a\u62df\u4e3b\u673a<\/h3>\n<p>\u3010\u4f7f\u7528\u9891\u7387&#xff1a;\u9ad8\u3011\u540c\u4e00\u53f0 Web \u670d\u52a1\u5668\u5bf9\u5916\u63d0\u4f9b\u591a\u4e2a\u7ad9\u70b9\u3002 \u4e09\u79cd\u533a\u5206\u65b9\u5f0f&#xff1a;\u57df\u540d&#xff08;\u6700\u5e38\u7528&#xff09;\u3001\u7aef\u53e3\u3001IP&#xff08;\u57fa\u672c\u4e0d\u7528&#xff09;\u3002<\/p>\n<h4>11.1 \u57fa\u4e8e\u57df\u540d&#xff08;\u2b50 \u6700\u5e38\u7528&#xff09;<\/h4>\n<p>\/etc\/nginx\/conf.d\/vhost-name.conf&#xff1a;<\/p>\n<p>server {<br \/>\n    server_name web1.hero.cloud;<br \/>\n    root \/usr\/share\/nginx\/web1;<br \/>\n}<br \/>\nserver {<br \/>\n    server_name web2.hero.cloud;<br \/>\n    root \/usr\/share\/nginx\/web2;<br \/>\n}<\/p>\n<p>\u51c6\u5907\u76ee\u5f55\u548c\u9996\u9875&#xff1a;<\/p>\n<p><span class=\"token function\">mkdir<\/span> \/usr\/share\/nginx\/web<span class=\"token punctuation\">{<\/span><span class=\"token number\">1,2<\/span><span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> web1.hero.cloud <span class=\"token operator\">&gt;<\/span> \/usr\/share\/nginx\/web1\/index.html<br \/>\n<span class=\"token builtin class-name\">echo<\/span> web2.hero.cloud <span class=\"token operator\">&gt;<\/span> \/usr\/share\/nginx\/web2\/index.html<br \/>\nnginx <span class=\"token parameter variable\">-t<\/span> <span class=\"token operator\">&amp;&amp;<\/span> systemctl restart nginx<\/p>\n<p>\u5ba2\u6237\u7aef hosts&#xff1a;<\/p>\n<p>10.1.8.11 web1.hero.cloud<br \/>\n10.1.8.11 web2.hero.cloud<\/p>\n<p>\u6d4b\u8bd5&#xff1a;<\/p>\n<p><span class=\"token function\">curl<\/span> http:\/\/web1.hero.cloud\/   <span class=\"token comment\"># web1.hero.cloud<\/span><br \/>\n<span class=\"token function\">curl<\/span> http:\/\/web2.hero.cloud\/   <span class=\"token comment\"># web2.hero.cloud<\/span><\/p>\n<h4>11.2 \u57fa\u4e8e\u7aef\u53e3<\/h4>\n<p>server { listen 8081; server_name www.hero.cloud; root \/usr\/share\/nginx\/8081; }<br \/>\nserver { listen 8082; server_name www.hero.cloud; root \/usr\/share\/nginx\/8082; }<\/p>\n<p><span class=\"token function\">mkdir<\/span> \/usr\/share\/nginx\/808<span class=\"token punctuation\">{<\/span><span class=\"token number\">1,2<\/span><span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token builtin class-name\">echo<\/span> <span class=\"token number\">8081<\/span> <span class=\"token operator\">&gt;<\/span> \/usr\/share\/nginx\/8081\/index.html<br \/>\n<span class=\"token builtin class-name\">echo<\/span> <span class=\"token number\">8082<\/span> <span class=\"token operator\">&gt;<\/span> \/usr\/share\/nginx\/8082\/index.html<br \/>\nnginx <span class=\"token parameter variable\">-t<\/span> <span class=\"token operator\">&amp;&amp;<\/span> systemctl restart nginx<br \/>\n<span class=\"token function\">curl<\/span> http:\/\/www.hero.cloud:8081   <span class=\"token comment\"># 8081<\/span><br \/>\n<span class=\"token function\">curl<\/span> http:\/\/www.hero.cloud:8082   <span class=\"token comment\"># 8082<\/span><\/p>\n<p>&#x1f4a1; \u5b9e\u9a8c\u540e\u53ca\u65f6\u6e05\u7406&#xff08;\u79fb\u8d70\/\u5220\u9664 conf.d \u4e2d\u7684\u5b9e\u9a8c\u914d\u7f6e&#xff09;&#xff0c;\u907f\u514d\u5f71\u54cd\u540e\u7eed\u5b9e\u9a8c\u3002<\/p>\n<hr \/>\n<h2>\u603b\u7ed3\u7bc7<\/h2>\n<h3>\u4e00\u3001\u6838\u5fc3\u77e5\u8bc6\u94fe\u8def<\/h3>\n<p>MariaDB&#xff1a;<br \/>\n  \u8868 CRUD&#xff1a;SELECT(&#043;WHERE\/ORDER BY\/\u805a\u5408) \/ INSERT \/ UPDATE \/ DELETE&#xff1b;DROP \u5220\u8868<br \/>\n  \u7528\u6237&#xff1a;CREATE USER user&#064;host \u2192 GRANT&#xff08;*.* \/ \u5e93.* \/ \u8868 \/ \u5217&#xff09;\u2192 FLUSH PRIVILEGES<br \/>\n  \u5907\u4efd&#xff1a;\u903b\u8f91 mysqldump&#xff08;SQL\u6587\u672c\u3001\u53ef\u79fb\u690d\u3001\u6162&#xff09; vs \u7269\u7406&#xff08;\u62f7\u76ee\u5f55\u3001\u5feb&#xff09;<br \/>\n  \u4e3b\u4ece&#xff1a;\u4e3b\u5e93 binlog \u2192 \u4ece\u5e93 IO\u7ebf\u7a0b\u5199 relay log \u2192 SQL\u7ebf\u7a0b\u91cd\u653e<br \/>\n       db1(.13) \u5efa repl \u8d26\u53f7\/\u67e5\u4f4d\u70b9 \u2192 db2(.14) CHANGE MASTER &#043; START SLAVE<br \/>\n  \u5e94\u6025&#xff1a;skip-grant-tables \u7ed5\u8fc7\u9a8c\u8bc1\u540e\u4fee\u590d<\/p>\n<p>Nginx&#xff1a;<br \/>\n  \u90e8\u7f72 \u2192 \u914d\u7f6e\u5c42\u7ea7 \u5168\u5c40\/events(http\u2192server\u2192location)<br \/>\n       nginx -t \u6821\u9a8c \u2192 reload<br \/>\n  \u865a\u62df\u4e3b\u673a&#xff1a;\u57df\u540d&#xff08;\u5e38\u7528&#xff09;\/ \u7aef\u53e3<\/p>\n<h3>\u4e8c\u3001\u91cd\u70b9 \/ \u96be\u70b9 \/ \u9891\u7387<\/h3>\n<table>\n<tr>\u5185\u5bb9\u91cd\u8981\u5ea6\u9891\u7387<\/tr>\n<tbody>\n<tr>\n<td>SELECT \u6761\u4ef6\/\u6392\u5e8f\/\u805a\u5408\/\u591a\u8868<\/td>\n<td>\u2b50<\/td>\n<td>\u6781\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>INSERT\/UPDATE\/DELETE\u3001\u65e0 WHERE \u98ce\u9669<\/td>\n<td>\u2b50<\/td>\n<td>\u6781\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>\u7528\u6237\u4e0e GRANT \u56db\u7ea7\u6743\u9650\u3001\u6700\u5c0f\u6743\u9650<\/td>\n<td>\u2b50<\/td>\n<td>\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>mysqldump \u903b\u8f91\u5907\u4efd\u6062\u590d<\/td>\n<td>\u2b50<\/td>\n<td>\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>\u4e3b\u4ece\u539f\u7406&#xff08;binlog\/IO\/SQL \u7ebf\u7a0b&#xff09;<\/td>\n<td>&#x1f53a;<\/td>\n<td>\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>\u4e3b\u4ece\u5b9e\u8df5\u914d\u7f6e<\/td>\n<td>&#x1f53a;<\/td>\n<td>\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>skip-grant-tables \u5e94\u6025<\/td>\n<td>&#x1f53a;<\/td>\n<td>\u4e2d<\/td>\n<\/tr>\n<tr>\n<td>Nginx \u90e8\u7f72\u4e0e\u914d\u7f6e\u5c42\u7ea7<\/td>\n<td>\u2b50<\/td>\n<td>\u6781\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>nginx -t \/ reload\u3001location \u4f18\u5148\u7ea7<\/td>\n<td>&#x1f53a;<\/td>\n<td>\u9ad8<\/td>\n<\/tr>\n<tr>\n<td>\u865a\u62df\u4e3b\u673a&#xff08;\u57df\u540d\/\u7aef\u53e3&#xff09;<\/td>\n<td>\u2b50<\/td>\n<td>\u9ad8<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u4e09\u3001\u6613\u9519\u6e05\u5355<\/h3>\n<li>&#x1f53a; UPDATE\/DELETE \u4e0d\u5e26 WHERE \u4f1a\u6539\u52a8\/\u6e05\u7a7a\u5168\u8868&#xff0c;\u6267\u884c\u524d\u518d\u4e09\u786e\u8ba4\u3002<\/li>\n<li>&#x1f53a; DELETE \u5220\u6570\u636e\u3001DROP \u5220\u6574\u8868&#xff0c;\u522b\u6df7\u6dc6\u3002<\/li>\n<li>&#x1f53a; \u65b0\u5efa\u7528\u6237\u5fc5\u987b\u6388\u6743&#xff0c;\u5426\u5219\u53ea\u80fd\u770b\u5230 information_schema\u3002<\/li>\n<li>&#x1f53a; \u751f\u4ea7\u907f\u514d user&#064;\u2018%\u2019 \u548c\u660e\u6587\u5bc6\u7801&#xff0c;\u9075\u5faa\u6700\u5c0f\u6743\u9650\u3002<\/li>\n<li>&#x1f53a; \u7269\u7406\u6062\u590d\u540e\u5fc5\u987b chown -R mysql:mysql\u3002<\/li>\n<li>&#x1f53a; \u4e3b\u4ece\u4e24\u5e93 server_id \u4e0d\u80fd\u91cd\u590d&#xff1b;CHANGE MASTER \u4f4d\u70b9\u8981\u6765\u81ea\u4e3b\u5e93\u771f\u5b9e\u72b6\u6001\u3002<\/li>\n<li>&#x1f53a; \u4e3b\u4ece\u770b\u4e24\u4e2a\u7ebf\u7a0b&#xff1a;Slave_IO_Running\u3001Slave_SQL_Running \u90fd\u8981 Yes\u3002<\/li>\n<li>&#x1f53a; \u6539 Nginx \u914d\u7f6e\u5148 nginx -t&#xff0c;\u518d reload\u3002<\/li>\n<li>&#x1f53a; \u57fa\u4e8e\u57df\u540d\u7684\u865a\u62df\u4e3b\u673a&#xff0c;\u5ba2\u6237\u7aef\u5fc5\u987b\u5148\u914d\u597d hosts\/DNS \u89e3\u6790\u3002<\/li>\n<li>&#x1f53a; Nginx \u9632\u706b\u5899\u653e\u884c http&#xff08;80&#xff09;\/https&#xff08;443&#xff09;\u3002<\/li>\n<h3>\u56db\u3001\u9762\u8bd5\u901f\u8bb0<\/h3>\n<li>DELETE\u3001TRUNCATE\u3001DROP \u533a\u522b&#xff1f; \u2192 DELETE \u6309\u6761\u4ef6\u5220\u884c&#xff08;\u53ef\u56de\u6eda&#xff09;&#xff1b;TRUNCATE \u6e05\u7a7a\u5168\u8868&#xff08;\u5feb\u3001\u4e0d\u53ef\u6309\u6761\u4ef6&#xff09;&#xff1b;DROP \u5220\u9664\u6574\u5f20\u8868&#xff08;\u7ed3\u6784&#043;\u6570\u636e&#xff09;\u3002<\/li>\n<li>MySQL \u6388\u6743\u7c92\u5ea6&#xff1f; \u2192 \u5168\u5c40 *.*\u3001\u5e93 \u5e93.*\u3001\u8868\u3001\u5217\u56db\u7ea7&#xff1b;\u9075\u5faa\u6700\u5c0f\u6743\u9650\u3002<\/li>\n<li>\u903b\u8f91\u5907\u4efd\u548c\u7269\u7406\u5907\u4efd\u533a\u522b&#xff1f; \u2192 \u903b\u8f91\u5bfc\u51fa SQL \u6587\u672c\u3001\u53ef\u79fb\u690d\u4f46\u6162&#xff1b;\u7269\u7406\u62f7\u6587\u4ef6\u3001\u5feb\u4f46\u4f9d\u8d56\u76f8\u540c\u73af\u5883\u3002<\/li>\n<li>\u4e3b\u4ece\u590d\u5236\u539f\u7406&#xff1f; \u2192 \u4e3b\u5e93\u5199 binlog&#xff1b;\u4ece\u5e93 IO \u7ebf\u7a0b\u62c9\u53d6\u5199 relay log&#xff1b;SQL \u7ebf\u7a0b\u91cd\u653e&#xff0c;\u6570\u636e\u6700\u7ec8\u4e00\u81f4\u3002<\/li>\n<li>\u5f02\u6b65\u548c\u534a\u540c\u6b65\u533a\u522b&#xff1f; \u2192 \u5f02\u6b65\u4e3b\u5e93\u4e0d\u7b49\u4ece\u5e93\u3001\u53ef\u80fd\u4e22\u6570\u636e&#xff1b;\u534a\u540c\u6b65\u7b49\u81f3\u5c11\u4e00\u4e2a\u4ece\u5e93\u786e\u8ba4&#xff0c;\u66f4\u5b89\u5168\u3002<\/li>\n<li>\u4e3b\u4ece\u5ef6\u8fdf\u600e\u4e48\u770b\u3001\u600e\u4e48\u4f18\u5316&#xff1f; \u2192 Seconds_Behind_Master&#xff1b;\u63d0\u5347\u4ece\u5e93\u914d\u7f6e\u3001\u5e76\u884c\u590d\u5236\u3001\u62c6\u5927\u4e8b\u52a1\u3001\u7ea7\u8054\u590d\u5236\u3002<\/li>\n<li>\u5fd8\u8bb0 MySQL root \u5bc6\u7801\u600e\u4e48\u529e&#xff1f; \u2192 skip-grant-tables \u542f\u52a8&#xff0c;\u514d\u5bc6\u767b\u5f55\u6539\u5bc6\u7801&#xff0c;\u518d\u53bb\u6389\u8be5\u53c2\u6570\u91cd\u542f\u3002<\/li>\n<li>Nginx \u914d\u7f6e\u6587\u4ef6\u5c42\u7ea7&#xff1f; \u2192 \u5168\u5c40\/events\/http\/server\/location&#xff1b;\u6539\u5b8c nginx -t \u518d reload\u3002<\/li>\n<li>Nginx \u865a\u62df\u4e3b\u673a\u600e\u4e48\u533a\u5206&#xff1f; \u2192 \u57df\u540d&#xff08;\u5e38\u7528&#xff09;\u3001\u7aef\u53e3\u3001IP\u3002<\/li>\n<li>Nginx \u5e38\u7528\u573a\u666f&#xff1f; \u2192 Web \u670d\u52a1\u5668\u3001\u53cd\u5411\u4ee3\u7406\u3001\u8d1f\u8f7d\u5747\u8861\u3001\u7f13\u5b58\u3002<\/li>\n","protected":false},"excerpt":{"rendered":"<p>MariaDB \u8fdb\u9636&#xff08;\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece&#xff09;\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8 \u672c\u6587\u4f7f\u7528\u901a\u4fd7\u5316\u3001\u4f53\u7cfb\u5316\u7684\u8bed\u8a00\u8bb2\u89e3MariaDB \u8fdb\u9636\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8\u7684\u76f8\u5173\u77e5\u8bc6&#xff0c;\u6bcf\u4e2a\u6982\u5ff5\u8bb2\u6e05\u300c\u662f\u4ec0\u4e48\u3001\u4e3a\u4ec0\u4e48\u3001\u600e\u4e48\u7528\u300d&#xff0c;\u6bcf\u6761\u547d\u4ee4\u89e3\u91ca\u300c\u610f\u56fe\u548c\u539f\u56e0\u300d&#xff0c;\u5e76\u901a\u8fc7\u5bf9\u6bd4\u8868\u683c\u3001\u67b6\u6784\u56fe\u89e3\u3001\u573a\u666f\u6807\u6ce8\u5e2e\u52a9\u7406\u89e3\u3002 &#x1f4cc; \u6807\u6ce8\u7ea6\u5b9a&#xff1a; \u3010\u4f7f\u7528\u9891\u7387\u3011\u771f\u5b9e\u8fd0\u7ef4\u5de5\u4f5c\u4e2d\u7684\u51fa\u73b0\u9891\u7387&#xff1a;\u6781\u9ad8 \/ \u9ad8 \/ \u4e2d<\/p>\n","protected":false},"author":2,"featured_media":114975,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,937,117,97,43],"topic":[],"class_list":["post-114976","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-mariadb","tag-nginx","tag-97","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MariaDB \u8fdb\u9636\uff08\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece\uff09\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\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.wsisp.com\/helps\/114976.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MariaDB \u8fdb\u9636\uff08\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece\uff09\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"MariaDB \u8fdb\u9636&#xff08;\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece&#xff09;\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8 \u672c\u6587\u4f7f\u7528\u901a\u4fd7\u5316\u3001\u4f53\u7cfb\u5316\u7684\u8bed\u8a00\u8bb2\u89e3MariaDB \u8fdb\u9636\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8\u7684\u76f8\u5173\u77e5\u8bc6&#xff0c;\u6bcf\u4e2a\u6982\u5ff5\u8bb2\u6e05\u300c\u662f\u4ec0\u4e48\u3001\u4e3a\u4ec0\u4e48\u3001\u600e\u4e48\u7528\u300d&#xff0c;\u6bcf\u6761\u547d\u4ee4\u89e3\u91ca\u300c\u610f\u56fe\u548c\u539f\u56e0\u300d&#xff0c;\u5e76\u901a\u8fc7\u5bf9\u6bd4\u8868\u683c\u3001\u67b6\u6784\u56fe\u89e3\u3001\u573a\u666f\u6807\u6ce8\u5e2e\u52a9\u7406\u89e3\u3002 &#x1f4cc; \u6807\u6ce8\u7ea6\u5b9a&#xff1a; \u3010\u4f7f\u7528\u9891\u7387\u3011\u771f\u5b9e\u8fd0\u7ef4\u5de5\u4f5c\u4e2d\u7684\u51fa\u73b0\u9891\u7387&#xff1a;\u6781\u9ad8 \/ \u9ad8 \/ \u4e2d\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/114976.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-10T09:49:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010094905-6aca0a11bca1d.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/114976.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/114976.html\",\"name\":\"MariaDB \u8fdb\u9636\uff08\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece\uff09\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-10T09:49:08+00:00\",\"dateModified\":\"2026-10-10T09:49:08+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/114976.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/114976.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/114976.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MariaDB \u8fdb\u9636\uff08\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece\uff09\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MariaDB \u8fdb\u9636\uff08\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece\uff09\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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.wsisp.com\/helps\/114976.html","og_locale":"zh_CN","og_type":"article","og_title":"MariaDB \u8fdb\u9636\uff08\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece\uff09\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"MariaDB \u8fdb\u9636&#xff08;\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece&#xff09;\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8 \u672c\u6587\u4f7f\u7528\u901a\u4fd7\u5316\u3001\u4f53\u7cfb\u5316\u7684\u8bed\u8a00\u8bb2\u89e3MariaDB \u8fdb\u9636\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8\u7684\u76f8\u5173\u77e5\u8bc6&#xff0c;\u6bcf\u4e2a\u6982\u5ff5\u8bb2\u6e05\u300c\u662f\u4ec0\u4e48\u3001\u4e3a\u4ec0\u4e48\u3001\u600e\u4e48\u7528\u300d&#xff0c;\u6bcf\u6761\u547d\u4ee4\u89e3\u91ca\u300c\u610f\u56fe\u548c\u539f\u56e0\u300d&#xff0c;\u5e76\u901a\u8fc7\u5bf9\u6bd4\u8868\u683c\u3001\u67b6\u6784\u56fe\u89e3\u3001\u573a\u666f\u6807\u6ce8\u5e2e\u52a9\u7406\u89e3\u3002 &#x1f4cc; \u6807\u6ce8\u7ea6\u5b9a&#xff1a; \u3010\u4f7f\u7528\u9891\u7387\u3011\u771f\u5b9e\u8fd0\u7ef4\u5de5\u4f5c\u4e2d\u7684\u51fa\u73b0\u9891\u7387&#xff1a;\u6781\u9ad8 \/ \u9ad8 \/ \u4e2d","og_url":"https:\/\/www.wsisp.com\/helps\/114976.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-10T09:49:08+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261010094905-6aca0a11bca1d.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"10 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/114976.html","url":"https:\/\/www.wsisp.com\/helps\/114976.html","name":"MariaDB \u8fdb\u9636\uff08\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece\uff09\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-10T09:49:08+00:00","dateModified":"2026-10-10T09:49:08+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/114976.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/114976.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/114976.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"MariaDB \u8fdb\u9636\uff08\u6570\u636e\u8868 \/ \u7528\u6237 \/ \u5907\u4efd \/ \u4e3b\u4ece\uff09\u4e0e Nginx \u670d\u52a1\u5668\u5165\u95e8"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/114976","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=114976"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/114976\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/114975"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=114976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=114976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=114976"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=114976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}