{"id":135478,"date":"2024-04-28T12:14:33","date_gmt":"2024-04-28T04:14:33","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/135478.html"},"modified":"2024-04-28T12:14:38","modified_gmt":"2024-04-28T04:14:38","slug":"linux%e4%b8%8b%e5%a6%82%e4%bd%95%e5%90%af%e5%8a%a8mysql","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/135478.html","title":{"rendered":"linux\u4e0b\u5982\u4f55\u542f\u52a8mysql"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24132646\/721c3070-e097-4102-8ba1-6c0a4cd4a62f.webp\" alt=\"linux\u4e0b\u5982\u4f55\u542f\u52a8mysql\" \/><\/p>\n<p><p><strong>\u5728Linux\u73af\u5883\u4e0b\u542f\u52a8MySQL\u4e3b\u8981\u53ef\u4ee5\u901a\u8fc7\u7cfb\u7edf\u670d\u52a1\u547d\u4ee4\u3001\u521d\u59cb\u5316\u811a\u672c\u6216\u8005\u76f4\u63a5\u4f7f\u7528mysqld_<a href=\"https:\/\/docs.pingcode.com\/agile\/agile-at-scale\/what-is-safe\" target=\"_blank\">SAFe<\/a>\u548cmysql.server\u811a\u672c<\/strong>\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u5982\u679cMySQL\u5df2\u6ce8\u518c\u4e3a\u670d\u52a1\uff0c\u5219\u53ef\u901a\u8fc7\u7cfb\u7edf\u7684\u670d\u52a1\u7ba1\u7406\u547d\u4ee4\u6765\u63a7\u5236\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8e\u57fa\u4e8esystemd\u7684\u7cfb\u7edf\uff0c\u53ef\u4ee5\u4f7f\u7528<code>systemctl start mysql.service<\/code>\u547d\u4ee4\u542f\u52a8\u670d\u52a1\u3002\u5bf9\u4e8e\u65e7\u7684SysVinit\u7cfb\u7edf\uff0c\u5219\u53ef\u80fd\u4f7f\u7528<code>service mysql start<\/code>\u547d\u4ee4\u3002\u53e6\u5916\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528MySQL\u63d0\u4f9b\u7684\u811a\u672c\u6765\u542f\u52a8\uff0c\u5176\u4e2d<code>mysqld_safe<\/code>\u811a\u672c\u5305\u542b\u4e86\u4e00\u4e9b\u7528\u4e8e\u542f\u52a8MySQL\u670d\u52a1\u5668\u7684\u903b\u8f91\uff0c\u6bd4\u5982\u91cd\u65b0\u542f\u52a8\u548c\u9519\u8bef\u65e5\u5fd7\u8bb0\u5f55\u7b49\u3002\u5728\u6ca1\u6709\u5b89\u88c5\u4e3a\u670d\u52a1\u7684\u60c5\u51b5\u4e0b\uff0c\u8fd9\u662f\u4e00\u79cd\u8f83\u4e3a\u901a\u7528\u7684\u542f\u52a8\u65b9\u5f0f\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u901a\u8fc7\u7cfb\u7edf\u670d\u52a1\u542f\u52a8MySQL<\/h3>\n<\/p>\n<p><p><strong>\u4f7f\u7528systemd\u542f\u52a8<\/strong><\/p>\n<\/p>\n<p><p>\u73b0\u4ee3Linux\u53d1\u884c\u7248\u5927\u591a\u4f7f\u7528systemd\u4f5c\u4e3a\u521d\u59cb\u5316\u7cfb\u7edf\u548c\u670d\u52a1\u7ba1\u7406\u5668\u3002\u5bf9\u4e8e\u8fd9\u4e9b\u7cfb\u7edf\uff0c\u4f7f\u7528systemctl\u547d\u4ee4\u53ef\u4ee5\u65b9\u4fbf\u5730\u7ba1\u7406MySQL\u670d\u52a1\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo systemctl start mysqld<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u786e\u4fdd\u670d\u52a1\u5df2\u7ecf\u6210\u529f\u542f\u52a8\uff0c\u53ef\u4ee5\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo systemctl status mysqld<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u884c\u5e94\u8be5\u4f1a\u663e\u793aMySQL\u670d\u52a1\u7684\u5f53\u524d\u72b6\u6001\uff0c\u8868\u660e\u670d\u52a1\u5df2\u7ecf\u5728\u8fd0\u884c\u4e2d\u3002<\/p>\n<\/p>\n<p><p><strong>\u4f7f\u7528SysVinit\u542f\u52a8<\/strong><\/p>\n<\/p>\n<p><p>\u5bf9\u4e8e\u8fd8\u672a\u91c7\u7528systemd\u7684\u8f83\u65e7Linux\u7cfb\u7edf\uff0c\u53ef\u4ee5\u4f7f\u7528service\u547d\u4ee4\u6216\/etc\/init.d\u76ee\u5f55\u4e0b\u7684\u542f\u52a8\u811a\u672c\u6765\u7ba1\u7406\u670d\u52a1\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo service mysql start<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216\u8005\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo \/etc\/init.d\/mysql start<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528mysqld_safe\u542f\u52a8MySQL<\/h3>\n<\/p>\n<p><p>\u5f53MySQL\u670d\u52a1\u6ca1\u6709\u6ce8\u518c\u4e3a\u7cfb\u7edf\u670d\u52a1\u65f6\uff0c\u6216\u8005\u9700\u624b\u52a8\u8fdb\u884c\u4e00\u4e9b\u7279\u522b\u7684\u914d\u7f6e\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code>mysqld_safe<\/code>\u811a\u672c\u6765\u542f\u52a8MySQL\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo mysqld_safe &amp;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6dfb\u52a0<code>&amp;<\/code>\u5c06\u8be5\u547d\u4ee4\u7f6e\u4e8e\u540e\u53f0\u8fd0\u884c\u3002<code>mysqld_safe<\/code>\u811a\u672c\u80fd\u4e3aMySQL\u670d\u52a1\u5668\u63d0\u4f9b\u4e00\u4e9b\u989d\u5916\u4fdd\u62a4\uff0c\u6bd4\u5982\u5728\u9047\u5230\u9519\u8bef\u65f6\u81ea\u52a8\u91cd\u542f\u670d\u52a1\uff0c\u4ee5\u53ca\u5728\u542f\u52a8\u65f6\u8bb0\u5f55\u8fd0\u884c\u65e5\u5fd7\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001\u4f7f\u7528mysql.server\u811a\u672c\u542f\u52a8MySQL<\/h3>\n<\/p>\n<p><p>\u4e00\u4e9bMySQL\u5b89\u88c5\u53ef\u80fd\u4f1a\u63d0\u4f9b<code>mysql.server<\/code>\u811a\u672c\uff0c\u8be5\u811a\u672c\u662f\u4e00\u4e2a\u5305\u88c5\u811a\u672c\uff0c\u5141\u8bb8\u7528\u6237\u4ee5\u4f20\u7edf\u65b9\u5f0f\u542f\u52a8\u540c\u610f\u5173\u505cMySQL\u670d\u52a1\u5668\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo mysql.server start<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e2a\u811a\u672c\u4e00\u822c\u4f4d\u4e8eMySQL\u7684\u5b89\u88c5\u76ee\u5f55\u4e0b\u7684<code>support-files<\/code>\u76ee\u5f55\u3002\u5728\u4f7f\u7528\u524d\uff0c\u786e\u8ba4\u8fd9\u4e2a\u811a\u672c\u5df2\u7ecf\u6b63\u786e\u6307\u5411\u4e86MySQL\u7684\u5b89\u88c5\u8def\u5f84\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u7ba1\u7406MySQL\u670d\u52a1\u7684\u5176\u4ed6\u547d\u4ee4<\/h3>\n<\/p>\n<p><p>\u7ba1\u7406MySQL\u670d\u52a1\u4e0d\u4ec5\u4ec5\u5c40\u9650\u4e8e\u542f\u52a8\u3002\u4ee5\u4e0b\u662f\u5176\u4ed6\u51e0\u4e2a\u4e0e\u670d\u52a1\u7ba1\u7406\u76f8\u5173\u7684\u547d\u4ee4\u3002<\/p>\n<\/p>\n<p><p><strong>\u68c0\u67e5\u8fd0\u884c\u72b6\u6001<\/strong><\/p>\n<\/p>\n<p><p>\u65e0\u8bba\u662f\u4f7f\u7528systemctl\u3001service\u8fd8\u662f\u76f4\u63a5\u7684\u811a\u672c\uff0c\u90fd\u53ef\u4ee5\u68c0\u67e5MySQL\u7684\u8fd0\u884c\u72b6\u6001\uff0c\u786e\u8ba4\u670d\u52a1\u5668\u662f\u5426\u542f\u52a8\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo systemctl status mysqld<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u91cd\u542fMySQL\u670d\u52a1<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u914d\u7f6e\u6587\u4ef6\u4fee\u6539\u6216\u4e3a\u66f4\u65b0\u914d\u7f6e\u65f6\uff0c\u9700\u8981\u91cd\u542f\u670d\u52a1\u3002<\/p>\n<\/p>\n<p><p>\u5bf9\u4e8esystemd\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo systemctl restart mysqld<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5bf9\u4e8eSysVinit\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo service mysql restart<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u505c\u6b62MySQL\u670d\u52a1<\/strong><\/p>\n<\/p>\n<p><p>\u6709\u65f6\u5019\u9700\u8981\u624b\u52a8\u505c\u6b62MySQL\u670d\u52a1\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><p>\u5bf9\u4e8esystemd\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo systemctl stop mysqld<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5bf9\u4e8eSysVinit\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo service mysql stop<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u5904\u7406MySQL\u542f\u52a8\u9519\u8bef<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\u5c1d\u8bd5\u542f\u52a8MySQL\u670d\u52a1\u53ef\u80fd\u4f1a\u9047\u5230\u9519\u8bef\u3002\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\u901a\u5e38\u9700\u8981\u68c0\u67e5\u6743\u9650\u3001\u914d\u7f6e\u6587\u4ef6\u3001\u78c1\u76d8\u7a7a\u95f4\u4ee5\u53ca\u7f51\u7edc\u8bbe\u7f6e\u7b49\u3002<\/p>\n<\/p>\n<p><p><strong>\u67e5\u770b\u9519\u8bef\u65e5\u5fd7<\/strong><\/p>\n<\/p>\n<p><p>MySQL\u7684\u9519\u8bef\u65e5\u5fd7\u6587\u4ef6\u5305\u542b\u6709\u5173\u670d\u52a1\u542f\u52a8\u5931\u8d25\u7684\u4fe1\u606f\uff0c\u5bf9\u4e8e\u8c03\u8bd5\u95ee\u9898\u81f3\u5173\u91cd\u8981\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">sudo cat \/var\/log\/mysql\/error.log<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u65e5\u5fd7\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u80fd\u6839\u636e\u4e0d\u540c\u7cfb\u7edf\u548c\u914d\u7f6e\u6709\u6240\u53d8\u5316\u3002<\/p>\n<\/p>\n<p><p><strong>\u786e\u8ba4\u6743\u9650<\/strong><\/p>\n<\/p>\n<p><p>\u786e\u8ba4\u542f\u52a8\u811a\u672c\u548cMySQL\u6570\u636e\u5e93\u76ee\u5f55\u7684\u6743\u9650\u8bbe\u7f6e\u6b63\u786e\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-shell\">ls -ld \/var\/lib\/mysql<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>MySQL\u7528\u6237\u9700\u8981\u6709\u76f8\u5e94\u76ee\u5f55\u7684\u8bfb\u5199\u6743\u9650\u3002<\/p>\n<\/p>\n<p><p><strong>\u786e\u8ba4\u914d\u7f6e\u6587\u4ef6<\/strong><\/p>\n<\/p>\n<p><p>\u68c0\u67e5MySQL\u7684\u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u4e3a\/etc\/my.cnf\u6216\/etc\/mysql\/my.cnf\uff09\uff0c\u786e\u4fdd\u8bbe\u7f6e\u6b63\u786e\u4e14\u672a\u51fa\u73b0\u8bed\u6cd5\u9519\u8bef\u3002<\/p>\n<\/p>\n<p><p><strong>\u76d1\u89c6\u78c1\u76d8\u7a7a\u95f4\u548c\u7f51\u7edc\u8bbe\u7f6e<\/strong><\/p>\n<\/p>\n<p><p>\u786e\u4fddMySQL\u670d\u52a1\u5668\u6709\u8db3\u591f\u7684\u78c1\u76d8\u7a7a\u95f4\u8fd0\u884c\uff0c\u540c\u65f6\u786e\u8ba4\u7f51\u7edc\u7aef\u53e3\u6ca1\u6709\u88ab\u5360\u7528\uff0c\u8fd9\u901a\u5e38\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u6307\u5b9a\u3002<\/p>\n<\/p>\n<p><p>\u603b\u7ed3\u8d77\u6765\uff0cLinux\u4e0b\u542f\u52a8MySQL\u662f\u901a\u8fc7\u670d\u52a1\u7ba1\u7406\u547d\u4ee4\u6216MySQL\u81ea\u5e26\u7684\u542f\u52a8\u811a\u672c\u6765\u5b8c\u6210\u3002\u6839\u636e\u4e0d\u540c\u7684Linux\u53d1\u884c\u7248\u548cMySQL\u7248\u672c\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u4e0d\u540c\u7684\u547d\u4ee4\u6216\u811a\u672c\u3002\u5728\u9047\u5230\u542f\u52a8\u95ee\u9898\u65f6\uff0c\u53ca\u65f6\u68c0\u67e5\u6743\u9650\u3001\u914d\u7f6e\u6587\u4ef6\u3001\u65e5\u5fd7\u548c\u7cfb\u7edf\u8d44\u6e90\u7b49\u56e0\u7d20\uff0c\u4ee5\u786e\u4fddMySQL\u80fd\u591f\u987a\u5229\u542f\u52a8\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>Q: \u6211\u5728Linux\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86MySQL\uff0c\u4f46\u4e0d\u77e5\u9053\u5982\u4f55\u542f\u52a8\u5b83\uff0c\u8be5\u600e\u4e48\u529e\uff1f<\/strong><\/p>\n<p>A: \u5728Linux\u4e2d\u542f\u52a8MySQL\uff0c\u60a8\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u6253\u5f00\u7ec8\u7aef\uff0c\u4f7f\u7528root\u6743\u9650\u767b\u5f55\u7cfb\u7edf\u3002<\/li>\n<li>\u8f93\u5165<code>service mysql start<\/code>\u547d\u4ee4\u6765\u542f\u52a8MySQL\u670d\u52a1\u3002\u8fd9\u4f1a\u542f\u52a8MySQL\u670d\u52a1\u5668\u5e76\u5f00\u59cb\u76d1\u542c\u8fde\u63a5\u8bf7\u6c42\u3002<\/li>\n<li>\u60a8\u8fd8\u53ef\u4ee5\u4f7f\u7528<code>\/etc\/init.d\/mysql start<\/code>\u547d\u4ee4\u6765\u542f\u52a8MySQL\u670d\u52a1\u3002<\/li>\n<li>\u60a8\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c<code>service mysql status<\/code>\u547d\u4ee4\u6765\u68c0\u67e5MySQL\u670d\u52a1\u662f\u5426\u5df2\u6210\u529f\u542f\u52a8\u3002<\/li>\n<\/ol>\n<p>\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e9b\u547d\u4ee4\u53ef\u80fd\u53d6\u51b3\u4e8e\u60a8\u6240\u4f7f\u7528\u7684Linux\u53d1\u884c\u7248\u548c\u7248\u672c\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662f\u4e0d\u540c\u7684\u53d1\u884c\u7248\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u4f7f\u7528\u4e0d\u540c\u7684\u547d\u4ee4\u6216\u65b9\u6cd5\u6765\u542f\u52a8MySQL\u670d\u52a1\u3002<\/p>\n<p><strong>Q: \u6211\u5728Linux\u4e0a\u5b89\u88c5\u4e86MySQL\uff0c\u4f46\u662f\u5728\u542f\u52a8\u65f6\u9047\u5230\u4e86\u95ee\u9898\uff0c\u5982\u4f55\u89e3\u51b3\uff1f<\/strong><\/p>\n<p>A: \u5982\u679c\u5728Linux\u4e0a\u542f\u52a8MySQL\u65f6\u9047\u5230\u95ee\u9898\uff0c\u60a8\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u89e3\u51b3\u65b9\u6cd5\uff1a<\/p>\n<ol>\n<li>\n<p>\u68c0\u67e5MySQL\u914d\u7f6e\u6587\u4ef6\uff1a\u786e\u4fddMySQL\u7684\u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u4e3a<code>my.cnf<\/code>\uff09\u4e2d\u6ca1\u6709\u9519\u8bef\u3002\u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u8be5\u6587\u4ef6\u5e76\u68c0\u67e5\u5173\u952e\u914d\u7f6e\u9879\uff0c\u5982\u7aef\u53e3\u53f7\u3001\u5957\u63a5\u5b57\u8def\u5f84\u3001\u65e5\u5fd7\u6587\u4ef6\u8def\u5f84\u7b49\u3002<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5\u65e5\u5fd7\u6587\u4ef6\uff1aMySQL\u901a\u5e38\u4f1a\u5c06\u542f\u52a8\u65f6\u7684\u9519\u8bef\u4fe1\u606f\u8bb0\u5f55\u5728\u65e5\u5fd7\u6587\u4ef6\u4e2d\u3002\u60a8\u53ef\u4ee5\u67e5\u770bMySQL\u7684\u9519\u8bef\u65e5\u5fd7\u6587\u4ef6\uff0c\u901a\u5e38\u4f4d\u4e8e<code>\/var\/log\/mysql\/error.log<\/code>\u3002\u67e5\u627e\u5e76\u89e3\u51b3\u65e5\u5fd7\u4e2d\u7684\u4efb\u4f55\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5\u6587\u4ef6\u6743\u9650\uff1a\u786e\u4fddMySQL\u7684\u6570\u636e\u76ee\u5f55\u548c\u65e5\u5fd7\u6587\u4ef6\u76ee\u5f55\u7684\u6743\u9650\u8bbe\u7f6e\u6b63\u786e\u3002\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u8fd9\u4e9b\u76ee\u5f55\u7684\u6743\u9650\u5e94\u4e3a<code>mysql<\/code>\u7528\u6237\u6240\u6709\u3002<\/p>\n<\/li>\n<li>\n<p>\u68c0\u67e5\u7aef\u53e3\u5360\u7528\uff1a\u68c0\u67e5\u662f\u5426\u6709\u5176\u4ed6\u7a0b\u5e8f\u6b63\u5728\u4f7f\u7528MySQL\u6240\u9700\u7684\u7aef\u53e3\uff08\u9ed8\u8ba4\u4e3a3306\uff09\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528<code>netstat<\/code>\u547d\u4ee4\u6216\u7c7b\u4f3c\u7684\u5de5\u5177\u6765\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u4e0a\u7684\u7f51\u7edc\u8fde\u63a5\u548c\u7aef\u53e3\u72b6\u6001\u3002<\/p>\n<\/li>\n<\/ol>\n<p>\u5982\u679c\u60a8\u9047\u5230\u5176\u4ed6\u9519\u8bef\u6216\u95ee\u9898\uff0c\u60a8\u53ef\u4ee5\u5c1d\u8bd5\u67e5\u9605MySQL\u5b98\u65b9\u6587\u6863\u6216\u793e\u533a\u4e2d\u7684\u5e2e\u52a9\u8d44\u6e90\uff0c\u6216\u63d0\u4ea4\u60a8\u7684\u95ee\u9898\u4ee5\u83b7\u5f97\u66f4\u5177\u4f53\u7684\u89e3\u51b3\u65b9\u6cd5\u3002<\/p>\n<p><strong>Q: \u5982\u4f55\u5728Linux\u7cfb\u7edf\u4e2d\u8bbe\u7f6eMySQL\u5f00\u673a\u81ea\u542f\u52a8\uff1f<\/strong><\/p>\n<p>A: \u5728Linux\u7cfb\u7edf\u4e2d\u8bbe\u7f6eMySQL\u5f00\u673a\u81ea\u542f\u52a8\uff0c\u60a8\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u64cd\u4f5c\uff1a<\/p>\n<ol>\n<li>\u4f7f\u7528root\u6743\u9650\u767b\u5f55\u7cfb\u7edf\u3002<\/li>\n<li>\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5<code>chkconfig<\/code>\u5de5\u5177\uff08\u5982\u679c\u5c1a\u672a\u5b89\u88c5\uff09\uff1a<code>sudo yum install chkconfig<\/code>\uff08\u9002\u7528\u4e8e\u57fa\u4e8eRed Hat\u3001CentOS\u7b49\u7cfb\u7edf\uff09\u6216<code>sudo apt-get install chkconfig<\/code>\uff08\u9002\u7528\u4e8e\u57fa\u4e8eDebian\u3001Ubuntu\u7b49\u7cfb\u7edf\uff09\u3002<\/li>\n<li>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u5c06MySQL\u6dfb\u52a0\u5230\u5f00\u673a\u81ea\u542f\u52a8\u5217\u8868\u4e2d\uff1a<code>sudo chkconfig --add mysql<\/code>\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u8bbe\u7f6eMySQL\u5728\u542f\u52a8\u548c\u5173\u95ed\u7cfb\u7edf\u65f6\u81ea\u52a8\u542f\u52a8\u548c\u5173\u95ed\uff1a<code>sudo chkconfig mysql on<\/code>\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u9a8c\u8bc1\u662f\u5426\u5df2\u6210\u529f\u6dfb\u52a0MySQL\u5230\u5f00\u673a\u81ea\u542f\u52a8\u5217\u8868\u4e2d\uff1a<code>chkconfig --list mysql<\/code>\u3002<\/li>\n<\/ol>\n<p>\u8bf7\u6ce8\u610f\uff0c\u6b64\u65b9\u6cd5\u53ef\u80fd\u4f1a\u56e0Linux\u53d1\u884c\u7248\u548c\u7248\u672c\u800c\u6709\u6240\u4e0d\u540c\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662f\u4e0d\u540c\u7684\u53d1\u884c\u7248\uff0c\u8bf7\u67e5\u9605\u76f8\u5173\u6587\u6863\u6216\u60a8\u7684\u53d1\u884c\u7248\u7684\u5b98\u65b9\u6307\u5357\uff0c\u4ee5\u4e86\u89e3\u51c6\u786e\u7684\u6b65\u9aa4\u548c\u547d\u4ee4\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Linux\u73af\u5883\u4e0b\u542f\u52a8MySQL\u4e3b\u8981\u53ef\u4ee5\u901a\u8fc7\u7cfb\u7edf\u670d\u52a1\u547d\u4ee4\u3001\u521d\u59cb\u5316\u811a\u672c\u6216\u8005\u76f4\u63a5\u4f7f\u7528mysqld_SAFe\u548cmys [&hellip;]","protected":false},"author":3,"featured_media":135488,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/135478"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=135478"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/135478\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/135488"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=135478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=135478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=135478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}