{"id":117080,"date":"2026-10-22T14:49:53","date_gmt":"2026-10-22T06:49:53","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/117080.html"},"modified":"2026-10-22T14:49:53","modified_gmt":"2026-10-22T06:49:53","slug":"%e5%8d%95%e6%9c%8d%e5%8a%a1%e5%99%a8-mysql-%e4%b8%bb%e4%bb%8e%e5%90%8c%e6%ad%a5%e9%83%a8%e7%bd%b2%e6%95%99%e7%a8%8b%ef%bc%88%e5%ae%9d%e5%a1%94-mysql-8-0%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/117080.html","title":{"rendered":"\u5355\u670d\u52a1\u5668 MySQL \u4e3b\u4ece\u540c\u6b65\u90e8\u7f72\u6559\u7a0b\uff08\u5b9d\u5854 + MySQL 8.0\uff09"},"content":{"rendered":"<p>        \/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/<br \/>\n        #content_views .toc,<br \/>\n        \/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/<br \/>\n        #content_views.markdown_views &gt; p:empty:has(+ .toc),<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty,<br \/>\n        \/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/<br \/>\n        #content_views.htmledit_views #main-toc,<br \/>\n        #content_views.htmledit_views #hr-toc,<br \/>\n        #content_views.htmledit_views p[id*=\\&#8221;-toc\\&#8221;] {<br \/>\n          display: none !important;<br \/>\n        }<br \/>\n        \/* \u76ee\u5f55\u53bb\u6389\u540e\uff0c\u7d27\u8ddf\u7684\u9996\u4e2a\u6807\u9898\u4e0d\u518d\u591a\u51fa\u4e00\u5757\u4e0a\u8fb9\u8ddd *\/<br \/>\n        #content_views.markdown_views &gt; .toc + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + h4,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h4 {<br \/>\n          margin-top: 0 !important;<br \/>\n        }<\/p>\n<p>\u4e0b\u9762\u662f\u7eaf\u6807\u51c6 Markdown \u683c\u5f0f\u5b8c\u6574\u6587\u6863&#xff0c;\u4f60\u53ef\u4ee5\u76f4\u63a5\u590d\u5236\u4fdd\u5b58\u4e3a MySQL\u4e3b\u4ece\u90e8\u7f72\u6559\u7a0b.md \u4f7f\u7528&#xff1a;<\/p>\n<hr \/>\n<h2>\u5355\u670d\u52a1\u5668 MySQL \u4e3b\u4ece\u540c\u6b65\u90e8\u7f72\u6559\u7a0b&#xff08;\u5b9d\u5854 &#043; MySQL 8.0&#xff09;<\/h2>\n<p>\u5305\u542b&#xff1a;\u914d\u7f6e\u8be6\u89e3 &#043; \u5b8c\u6574\u6b65\u9aa4 &#043; \u6240\u6709\u62a5\u9519\u89e3\u51b3\u65b9\u6848 &#043; \u771f\u5b9e\u73af\u5883\u53ef\u76f4\u63a5\u590d\u7528<\/p>\n<h3>\u4e00\u3001\u73af\u5883\u8bf4\u660e<\/h3>\n<ul>\n<li>\u7cfb\u7edf&#xff1a;CentOS 7<\/li>\n<li>\u9762\u677f&#xff1a;\u5b9d\u5854 BT-Panel<\/li>\n<li>MySQL \u7248\u672c&#xff1a;8.0.x<\/li>\n<li>\u90e8\u7f72\u6a21\u5f0f&#xff1a;\u5355\u670d\u52a1\u5668\u53cc\u5b9e\u4f8b\n<ul>\n<li>\u4e3b\u5e93&#xff08;Master&#xff09;&#xff1a;3306 \u7aef\u53e3<\/li>\n<li>\u4ece\u5e93&#xff08;Slave&#xff09;&#xff1a;3307 \u7aef\u53e3<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u8d26\u53f7\u4fe1\u606f<\/h4>\n<ul>\n<li>\u4e3b\u5e93 root \u5bc6\u7801&#xff1a;e800ffb698b8e2e2<\/li>\n<li>\u4ece\u5e93 root \u5bc6\u7801&#xff1a;123456<\/li>\n<li>\u4e3b\u4ece\u540c\u6b65\u8d26\u53f7&#xff1a;repl \/ Repl&#064;123456<\/li>\n<li>\u4e1a\u52a1\u5e93&#xff1a;ry-glass&#xff0c;\u4e1a\u52a1\u8d26\u53f7&#xff1a;root-glass \/ root-glass<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e8c\u3001\u4ece\u5e93&#xff08;3307&#xff09;\u914d\u7f6e\u6587\u4ef6\u53ca\u8bf4\u660e<\/h3>\n<h4>2.1 \u521b\u5efa\u4ece\u5e93\u914d\u7f6e<\/h4>\n<p><span class=\"token function\">vi<\/span> \/etc\/my_slave.cnf<\/p>\n<h4>2.2 \u5b8c\u6574\u914d\u7f6e&#xff08;\u9010\u884c\u89e3\u91ca&#xff09;<\/h4>\n<p>[mysqld]<br \/>\n# \u4ece\u5e93\u7aef\u53e3&#xff0c;\u4e0d\u80fd\u4e0e\u4e3b\u5e93 3306 \u91cd\u590d<br \/>\nport&#061;3307<\/p>\n<p># \u4ece\u5e93\u6570\u636e\u76ee\u5f55&#xff0c;\u5fc5\u987b\u72ec\u7acb<br \/>\ndatadir&#061;\/www\/server\/data_slave<\/p>\n<p># \u4ece\u5e93\u672c\u5730\u8fde\u63a5\u7528 socket<br \/>\nsocket&#061;\/tmp\/mysql_slave.sock<\/p>\n<p># \u670d\u52a1\u5668\u552f\u4e00 ID&#xff0c;\u4e3b\u5e93\u5fc5\u987b\u4e3a 1&#xff0c;\u4ece\u5e93\u4e0d\u80fd\u76f8\u540c<br \/>\nserver-id&#061;2<\/p>\n<p># \u5f00\u542f\u4e8c\u8fdb\u5236\u65e5\u5fd7<br \/>\nlog-bin&#061;mysql-bin<\/p>\n<p># \u4ece\u5e93\u4e2d\u7ee7\u65e5\u5fd7&#xff0c;\u7528\u4e8e\u63a5\u6536\u4e3b\u5e93\u65e5\u5fd7<br \/>\nrelay-log&#061;relay-bin<\/p>\n<p># \u4ece\u5e93\u8bbe\u4e3a\u53ea\u8bfb&#xff08;\u666e\u901a\u7528\u6237\u65e0\u6cd5\u5199\u5165&#xff09;<br \/>\nread_only&#061;1<\/p>\n<p># \u8d85\u7ea7\u7ba1\u7406\u5458\u4e5f\u5f3a\u5236\u53ea\u8bfb&#xff08;\u751f\u4ea7\u5fc5\u5f00&#xff09;<br \/>\nsuper_read_only&#061;1<\/p>\n<p>symbolic-links&#061;0<\/p>\n<p># \u5b57\u7b26\u96c6<br \/>\ncharacter-set-server&#061;utf8mb4<br \/>\ncollation-server&#061;utf8mb4_unicode_ci<\/p>\n<p># \u9519\u8bef\u65e5\u5fd7<br \/>\nlog-error&#061;\/www\/server\/data_slave\/error.log<\/p>\n<p># PID \u8fdb\u7a0b\u6587\u4ef6<br \/>\npid-file&#061;\/www\/server\/data_slave\/mysql.pid<\/p>\n<h4>2.3 \u5173\u952e\u914d\u7f6e\u8bf4\u660e<\/h4>\n<table>\n<tr>\u914d\u7f6e\u9879\u4f5c\u7528<\/tr>\n<tbody>\n<tr>\n<td>port<\/td>\n<td>\u4ece\u5e93\u7aef\u53e3&#xff0c;\u5fc5\u987b\u4e0e\u4e3b\u5e93\u4e0d\u540c<\/td>\n<\/tr>\n<tr>\n<td>server-id<\/td>\n<td>\u5168\u5c40\u552f\u4e00&#xff0c;\u4e3b\u5e93&#061;1&#xff0c;\u4ece\u5e93\u5fc5\u987b\u4e0d\u540c<\/td>\n<\/tr>\n<tr>\n<td>log-bin<\/td>\n<td>\u5f00\u542f binlog&#xff0c;\u4e3b\u4ece\u540c\u6b65\u5fc5\u987b\u5f00\u542f<\/td>\n<\/tr>\n<tr>\n<td>relay-log<\/td>\n<td>\u4ece\u5e93\u4e13\u7528&#xff0c;\u63a5\u6536\u5e76\u56de\u653e\u4e3b\u5e93\u65e5\u5fd7<\/td>\n<\/tr>\n<tr>\n<td>read_only<\/td>\n<td>\u4ece\u5e93\u53ea\u8bfb&#xff0c;\u9632\u6b62\u8bef\u5199\u5165<\/td>\n<\/tr>\n<tr>\n<td>super_read_only<\/td>\n<td>\u5f3a\u5236\u8d85\u7ea7\u6743\u9650\u53ea\u8bfb&#xff0c;\u751f\u4ea7\u73af\u5883\u5fc5\u5907<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h3>\u4e09\u3001\u4ece\u5e93\u521d\u59cb\u5316\u4e0e\u542f\u52a8<\/h3>\n<p><span class=\"token comment\"># \u521b\u5efa\u6570\u636e\u76ee\u5f55<\/span><br \/>\n<span class=\"token function\">mkdir<\/span> <span class=\"token parameter variable\">-p<\/span> \/www\/server\/data_slave<\/p>\n<p><span class=\"token comment\"># \u6388\u6743<\/span><br \/>\n<span class=\"token function\">chown<\/span> <span class=\"token parameter variable\">-R<\/span> mysql:mysql \/www\/server\/data_slave<br \/>\n<span class=\"token function\">chmod<\/span> <span class=\"token number\">700<\/span> \/www\/server\/data_slave<\/p>\n<p><span class=\"token comment\"># \u521d\u59cb\u5316&#xff08;\u65e0\u5bc6\u7801&#xff09;<\/span><br \/>\n\/www\/server\/mysql\/bin\/mysqld &#8211;defaults-file<span class=\"token operator\">&#061;<\/span>\/etc\/my_slave.cnf &#8211;initialize-insecure <span class=\"token parameter variable\">&#8211;user<\/span><span class=\"token operator\">&#061;<\/span>mysql<\/p>\n<p><span class=\"token comment\"># \u542f\u52a8\u4ece\u5e93<\/span><br \/>\n\/www\/server\/mysql\/bin\/mysqld_safe &#8211;defaults-file<span class=\"token operator\">&#061;<\/span>\/etc\/my_slave.cnf <span class=\"token parameter variable\">&#8211;user<\/span><span class=\"token operator\">&#061;<\/span>mysql <span class=\"token operator\">&amp;<\/span><\/p>\n<h4>\u8bbe\u7f6e\u4ece\u5e93 root \u5bc6\u7801<\/h4>\n<p>\/www\/server\/mysql\/bin\/mysql <span class=\"token parameter variable\">-uroot<\/span> <span class=\"token parameter variable\">-S<\/span> \/tmp\/mysql_slave.sock <span class=\"token parameter variable\">-P3307<\/span><\/p>\n<p><span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">USER<\/span> <span class=\"token string\">&#039;root&#039;<\/span><span class=\"token variable\">&#064;&#039;localhost&#039;<\/span> IDENTIFIED <span class=\"token keyword\">BY<\/span> <span class=\"token string\">&#039;123456&#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\">exit<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<hr \/>\n<h3>\u56db\u3001\u4e3b\u5e93&#xff08;3306&#xff09;\u914d\u7f6e<\/h3>\n<h4>4.1 \u4e3b\u5e93\u914d\u7f6e\u68c0\u67e5<\/h4>\n<p>\u4e3b\u5e93 \/etc\/my.cnf \u5fc5\u987b\u5305\u542b&#xff1a;<\/p>\n<p>server-id&#061;1<br \/>\nlog-bin&#061;mysql-bin<\/p>\n<p>\u4fee\u6539\u540e\u91cd\u542f&#xff1a;<\/p>\n<p>systemctl restart mysqld<\/p>\n<h4>4.2 \u521b\u5efa\u540c\u6b65\u8d26\u53f7<\/h4>\n<p>\/www\/server\/mysql\/bin\/mysql <span class=\"token parameter variable\">-uroot<\/span> -p<span class=\"token string\">&#039;e800ffb698b8e2e2&#039;<\/span><\/p>\n<p><span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">USER<\/span> <span class=\"token string\">&#039;repl&#039;<\/span><span class=\"token variable\">&#064;&#039;localhost&#039;<\/span> IDENTIFIED <span class=\"token keyword\">BY<\/span> <span class=\"token string\">&#039;Repl&#064;123456&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">GRANT<\/span> <span class=\"token keyword\">REPLICATION<\/span> SLAVE <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;repl&#039;<\/span><span class=\"token variable\">&#064;&#039;localhost&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\nFLUSH <span class=\"token keyword\">PRIVILEGES<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h4>4.3 \u67e5\u770b\u4e3b\u5e93 binlog \u4f4d\u7f6e<\/h4>\n<p><span class=\"token keyword\">SHOW<\/span> MASTER <span class=\"token keyword\">STATUS<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u8bb0\u5f55&#xff1a;<\/p>\n<ul>\n<li>File: mysql-bin.000007<\/li>\n<li>Position: 156<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e94\u3001\u914d\u7f6e\u4ece\u5e93\u8fde\u63a5\u4e3b\u5e93<\/h3>\n<p>\/www\/server\/mysql\/bin\/mysql <span class=\"token parameter variable\">-uroot<\/span> <span class=\"token parameter variable\">-p123456<\/span> <span class=\"token parameter variable\">-S<\/span> \/tmp\/mysql_slave.sock <span class=\"token parameter variable\">-P3307<\/span><\/p>\n<p>STOP SLAVE<span class=\"token punctuation\">;<\/span><br \/>\nRESET SLAVE <span class=\"token keyword\">ALL<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>CHANGE MASTER <span class=\"token keyword\">TO<\/span><br \/>\nMASTER_HOST<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;127.0.0.1&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\nMASTER_USER<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;repl&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\nMASTER_PASSWORD<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;Repl&#064;123456&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\nMASTER_PORT<span class=\"token operator\">&#061;<\/span><span class=\"token number\">3306<\/span><span class=\"token punctuation\">,<\/span><br \/>\nMASTER_LOG_FILE<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#039;mysql-bin.000007&#039;<\/span><span class=\"token punctuation\">,<\/span><br \/>\nMASTER_LOG_POS<span class=\"token operator\">&#061;<\/span><span class=\"token number\">156<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token keyword\">START<\/span> SLAVE<span class=\"token punctuation\">;<\/span><\/p>\n<h4>\u67e5\u770b\u540c\u6b65\u72b6\u6001<\/h4>\n<p><span class=\"token keyword\">SHOW<\/span> SLAVE <span class=\"token keyword\">STATUS<\/span>\\\\G<\/p>\n<p>\u6210\u529f\u6807\u5fd7<\/p>\n<p>Slave_IO_Running: Yes<br \/>\nSlave_SQL_Running: Yes<br \/>\nSeconds_Behind_Master: 0<\/p>\n<hr \/>\n<h3>\u516d\u3001\u6240\u6709\u5e38\u89c1\u62a5\u9519\u53ca\u89e3\u51b3\u65b9\u6848&#xff08;\u771f\u5b9e\u73af\u5883\u5168\u8986\u76d6&#xff09;<\/h3>\n<h4>\u9519\u8bef 1&#xff1a;Can\u2019t connect to MySQL server on \u2018127.0.0.1:3306\u2019 (111)<\/h4>\n<ul>\n<li>\u539f\u56e0&#xff1a;\u4e3b\u5e93\u672a\u542f\u52a8 \/ \u7f51\u7edc\u4e0d\u901a<\/li>\n<li>\u89e3\u51b3&#xff1a;systemctl start mysqld<br \/>\nsystemctl stop firewalld<\/p>\n<\/li>\n<\/ul>\n<h4>\u9519\u8bef 2&#xff1a;Access denied for user \u2018repl\u2019&#064;\u2018localhost\u2019<\/h4>\n<ul>\n<li>\u539f\u56e0&#xff1a;\u540c\u6b65\u8d26\u53f7\u6216\u5bc6\u7801\u9519\u8bef<\/li>\n<li>\u89e3\u51b3&#xff1a;\u91cd\u65b0\u521b\u5efa repl \u8d26\u53f7<\/li>\n<\/ul>\n<h4>\u9519\u8bef 3&#xff1a;Unknown database \u2018ry-glass\u2019<\/h4>\n<ul>\n<li>\u539f\u56e0&#xff1a;\u4ece\u5e93\u7f3a\u5c11\u4e1a\u52a1\u5e93<\/li>\n<li>\u89e3\u51b3&#xff1a;<span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">DATABASE<\/span> <span class=\"token keyword\">IF<\/span> <span class=\"token operator\">NOT<\/span> <span class=\"token keyword\">EXISTS<\/span> <span class=\"token identifier\"><span class=\"token punctuation\">&#096;<\/span>ry-glass<span class=\"token punctuation\">&#096;<\/span><\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">USER<\/span> <span class=\"token string\">&#039;root-glass&#039;<\/span><span class=\"token variable\">&#064;&#039;%&#039;<\/span> IDENTIFIED <span class=\"token keyword\">BY<\/span> <span class=\"token string\">&#039;root-glass&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">GRANT<\/span> <span class=\"token keyword\">ALL<\/span> <span class=\"token keyword\">ON<\/span> <span class=\"token identifier\"><span class=\"token punctuation\">&#096;<\/span>ry-glass<span class=\"token punctuation\">&#096;<\/span><\/span><span class=\"token punctuation\">.<\/span><span class=\"token operator\">*<\/span> <span class=\"token keyword\">TO<\/span> <span class=\"token string\">&#039;root-glass&#039;<\/span><span class=\"token variable\">&#064;&#039;%&#039;<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<\/li>\n<\/ul>\n<h4>\u9519\u8bef 4&#xff1a;Table \u2018ry-glass.device_glass\u2019 doesn\u2019t exist<\/h4>\n<ul>\n<li>\u539f\u56e0&#xff1a;\u4ece\u5e93\u6709\u5e93\u65e0\u8868<\/li>\n<li>\u89e3\u51b3&#xff1a;\u91cd\u65b0\u914d\u7f6e\u4e3b\u4ece&#xff0c;\u4ece\u6700\u65b0 binlog \u5f00\u59cb\u540c\u6b65<\/li>\n<\/ul>\n<h4>\u9519\u8bef 5&#xff1a;Slave_SQL_Running: No&#xff0c;Operation DROP USER failed<\/h4>\n<ul>\n<li>\u539f\u56e0&#xff1a;\u4e3b\u5e93\u5220\u9664\u4e0d\u5b58\u5728\u7528\u6237<\/li>\n<li>\u89e3\u51b3&#xff1a;STOP SLAVE<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SET<\/span> <span class=\"token keyword\">GLOBAL<\/span> SQL_SLAVE_SKIP_COUNTER<span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">START<\/span> SLAVE<span class=\"token punctuation\">;<\/span><\/p>\n<\/li>\n<\/ul>\n<h4>\u9519\u8bef 6&#xff1a;ERROR 2002&#xff1a;Can\u2019t connect to socket<\/h4>\n<ul>\n<li>\u539f\u56e0&#xff1a;\u672a\u6307\u5b9a\u4ece\u5e93 socket<\/li>\n<li>\u89e3\u51b3&#xff1a;\u767b\u5f55\u5fc5\u987b\u52a0 -S \/tmp\/mysql_slave.sock<\/li>\n<\/ul>\n<h4>\u9519\u8bef 7&#xff1a;GTID_MODE &#061; OFF \u65e0\u6cd5\u4f7f\u7528 AUTO_POSITION<\/h4>\n<ul>\n<li>\u539f\u56e0&#xff1a;\u672a\u5f00\u542f GTID<\/li>\n<li>\u89e3\u51b3&#xff1a;\u6539\u7528 MASTER_LOG_FILE &#043; POS \u6a21\u5f0f<\/li>\n<\/ul>\n<h4>\u9519\u8bef 8&#xff1a;The server is not configured as slave<\/h4>\n<ul>\n<li>\u539f\u56e0&#xff1a;\u672a\u6267\u884c CHANGE MASTER TO<\/li>\n<li>\u89e3\u51b3&#xff1a;\u5148\u914d\u7f6e\u4e3b\u4ece\u4fe1\u606f\u518d\u542f\u52a8 slave<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e03\u3001\u540c\u6b65\u6d4b\u8bd5<\/h3>\n<h4>\u4e3b\u5e93\u6267\u884c<\/h4>\n<p><span class=\"token keyword\">USE<\/span> ry<span class=\"token operator\">&#8211;<\/span>glass<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">TABLE<\/span> test<span class=\"token punctuation\">(<\/span>id <span class=\"token keyword\">INT<\/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> test <span class=\"token keyword\">VALUES<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">666<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<h4>\u4ece\u5e93\u67e5\u8be2<\/h4>\n<p><span class=\"token keyword\">USE<\/span> ry<span class=\"token operator\">&#8211;<\/span>glass<span class=\"token punctuation\">;<\/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><\/p>\n<p>\u80fd\u67e5\u5230\u6570\u636e\u5373\u540c\u6b65\u6b63\u5e38\u3002<\/p>\n<hr \/>\n<h3>\u516b\u3001\u751f\u4ea7\u5b89\u5168\u89c4\u8303<\/h3>\n<li>\u4ece\u5e93\u5fc5\u987b\u5f00\u542f read_only&#061;1<\/li>\n<li>\u4ece\u5e93\u4e0d\u63d0\u4f9b\u5199\u5165\u4e1a\u52a1<\/li>\n<li>\u7981\u6b62\u5728\u4ece\u5e93\u624b\u52a8\u5efa\u8868<\/li>\n<li>\u4e3b\u5e93\u5b9a\u671f\u5168\u91cf\u5907\u4efd<\/li>\n<li>\u540c\u6b65\u8d26\u53f7\u6743\u9650\u6700\u5c0f\u5316<\/li>\n<hr \/>\n<h3>\u4e5d\u3001\u5f00\u673a\u81ea\u542f<\/h3>\n<p><span class=\"token builtin class-name\">echo<\/span> <span class=\"token string\">&#034;\/www\/server\/mysql\/bin\/mysqld_safe &#8211;defaults-file&#061;\/etc\/my_slave.cnf &#8211;user&#061;mysql &amp;&#034;<\/span> <span class=\"token operator\">&gt;&gt;<\/span> \/etc\/rc.local<br \/>\n<span class=\"token function\">chmod<\/span> &#043;x \/etc\/rc.local<\/p>\n<hr \/>\n<h3>\u5341\u3001\u5e38\u7528\u8fd0\u7ef4\u547d\u4ee4<\/h3>\n<p><span class=\"token comment\">&#8212; \u67e5\u770b\u4e3b\u4ece\u72b6\u6001<\/span><br \/>\n<span class=\"token keyword\">SHOW<\/span> SLAVE <span class=\"token keyword\">STATUS<\/span>\\\\G<span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token comment\">&#8212; \u91cd\u542f\u540c\u6b65<\/span><br \/>\nSTOP SLAVE<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">START<\/span> SLAVE<span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token comment\">&#8212; \u8df3\u8fc7\u4e00\u6761\u9519\u8bef SQL<\/span><br \/>\nSTOP SLAVE<span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SET<\/span> <span class=\"token keyword\">GLOBAL<\/span> SQL_SLAVE_SKIP_COUNTER<span class=\"token operator\">&#061;<\/span><span class=\"token number\">1<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">START<\/span> SLAVE<span class=\"token punctuation\">;<\/span><\/p>\n<p><span class=\"token comment\">&#8212; \u91cd\u7f6e\u4e3b\u4ece\u914d\u7f6e<\/span><br \/>\nRESET SLAVE <span class=\"token keyword\">ALL<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<hr \/>\n","protected":false},"excerpt":{"rendered":"<p>\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[116,114,43],"topic":[],"class_list":["post-117080","post","type-post","status-publish","format-standard","hentry","category-server","tag-adb","tag-mysql","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5355\u670d\u52a1\u5668 MySQL \u4e3b\u4ece\u540c\u6b65\u90e8\u7f72\u6559\u7a0b\uff08\u5b9d\u5854 + MySQL 8.0\uff09 - \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\/117080.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5355\u670d\u52a1\u5668 MySQL \u4e3b\u4ece\u540c\u6b65\u90e8\u7f72\u6559\u7a0b\uff08\u5b9d\u5854 + MySQL 8.0\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/117080.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-22T06:49:53+00:00\" \/>\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=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/117080.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/117080.html\",\"name\":\"\u5355\u670d\u52a1\u5668 MySQL \u4e3b\u4ece\u540c\u6b65\u90e8\u7f72\u6559\u7a0b\uff08\u5b9d\u5854 + MySQL 8.0\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-22T06:49:53+00:00\",\"dateModified\":\"2026-10-22T06:49:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/117080.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/117080.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/117080.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5355\u670d\u52a1\u5668 MySQL \u4e3b\u4ece\u540c\u6b65\u90e8\u7f72\u6559\u7a0b\uff08\u5b9d\u5854 + MySQL 8.0\uff09\"}]},{\"@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":"\u5355\u670d\u52a1\u5668 MySQL \u4e3b\u4ece\u540c\u6b65\u90e8\u7f72\u6559\u7a0b\uff08\u5b9d\u5854 + MySQL 8.0\uff09 - \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\/117080.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5355\u670d\u52a1\u5668 MySQL \u4e3b\u4ece\u540c\u6b65\u90e8\u7f72\u6559\u7a0b\uff08\u5b9d\u5854 + MySQL 8.0\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content","og_url":"https:\/\/www.wsisp.com\/helps\/117080.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-22T06:49:53+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/117080.html","url":"https:\/\/www.wsisp.com\/helps\/117080.html","name":"\u5355\u670d\u52a1\u5668 MySQL \u4e3b\u4ece\u540c\u6b65\u90e8\u7f72\u6559\u7a0b\uff08\u5b9d\u5854 + MySQL 8.0\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-22T06:49:53+00:00","dateModified":"2026-10-22T06:49:53+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/117080.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/117080.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/117080.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5355\u670d\u52a1\u5668 MySQL \u4e3b\u4ece\u540c\u6b65\u90e8\u7f72\u6559\u7a0b\uff08\u5b9d\u5854 + MySQL 8.0\uff09"}]},{"@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\/117080","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=117080"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/117080\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=117080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=117080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=117080"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=117080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}