{"id":348,"date":"2022-10-11T20:36:59","date_gmt":"2022-10-11T12:36:59","guid":{"rendered":"https:\/\/tianzi.pro\/?p=348"},"modified":"2022-10-11T20:50:15","modified_gmt":"2022-10-11T12:50:15","slug":"ubuntu-%e4%b8%8b%e5%ae%9a%e6%97%b6%e7%9b%91%e6%b5%8b-mysql-%e8%bf%9b%e7%a8%8b%e7%bb%88%e6%ad%a2%e5%90%8e%e8%87%aa%e5%8a%a8%e9%87%8d%e5%90%af%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/tianzi.pro\/?p=348","title":{"rendered":"Ubuntu \u4e0b\u5b9a\u65f6\u76d1\u6d4b MySQL \u8fdb\u7a0b\u7ec8\u6b62\u540e\u81ea\u52a8\u91cd\u542f\u7684\u65b9\u6cd5"},"content":{"rendered":"<blockquote><p>https:\/\/blog.csdn.net\/qq_36272282\/article\/details\/91418404<\/p>\n<p>https:\/\/cloud.tencent.com\/developer\/article\/1004643<\/p><\/blockquote>\n<h1 id=\"%E5%89%8D%E8%A8%80\">\u524d\u8a00<\/h1>\n<p>\u6700\u8fd1\u53d1\u73b0<a href=\"https:\/\/cloud.tencent.com\/product\/cdb?from=10680\" target=\"_blank\" rel=\"noopener\" data-text-link=\"22_1004643\" data-from=\"10680\">MySQL<\/a>\u670d\u52a1\u9694\u4e09\u5dee\u4e94\u5c31\u4f1a\u6302\u6389\uff0c\u5bfc\u81f4\u6211\u7684\u7f51\u7ad9\u548c\u722c\u866b\u90fd\u65e0\u6cd5\u6b63\u5e38\u8fd0\u4f5c\u3002\u81ea\u5df1\u7684\u7f51\u7ad9\u662f\u57fa\u4e8eMySQL\uff0c\u5728\u505a\u722c\u866b\u5b58\u53d6\u4e00\u4e9b\u8d44\u6599\u7684\u65f6\u5019\u4e5f\u662f\u57fa\u4e8eMySQL\uff0c\u6570\u636e\u91cf\u4e00\u5927\u4e86\uff0cMySQL\u5b83\u5c31\u6709\u70b9\u53d7\u4e0d\u4e86\u4e86\uff0c\u65f6\u4e0d\u65f6\u4f1a\u5d29\u6389\uff0c\u867d\u7136\u6211\u81ea\u5df1\u6709<a href=\"https:\/\/cloud.tencent.com\/product\/cat?from=10680\" target=\"_blank\" rel=\"noopener\" data-text-link=\"46_1004643\" data-from=\"10680\">\u7f51\u7ad9\u76d1\u63a7<\/a>\u548c\u90ae\u4ef6\u901a\u77e5\uff0c\u4f46\u662f\u597d\u591a\u65f6\u5019\u8fd8\u662f\u9700\u8981\u6211\u6765\u624b\u52a8\u8fde\u63a5\u6211\u7684<a href=\"https:\/\/cloud.tencent.com\/product\/cvm?from=10680\" target=\"_blank\" rel=\"noopener\" data-text-link=\"375_1004643\" data-from=\"10680\">\u670d\u52a1\u5668<\/a>\u91cd\u65b0\u542f\u52a8\u4e00\u4e0b\u6211\u7684MySQL\uff0c\u8fd9\u6837\u7b80\u76f4\u592a\u4e0d\u53cb\u597d\u4e86\uff0c\u6240\u4ee5\uff0c\u6211\u5c31\u89c9\u5b9a\u81ea\u5df1\u5199\u4e2a\u811a\u672c\uff0c\u5b9a\u65f6\u76d1\u63a7\u5b83\uff0c\u5982\u679c\u53d1\u73b0\u5b83\u6302\u6389\u4e86\u5c31\u91cd\u542f\u5b83\u3002<\/p>\n<p>\u597d\u4e86\uff0c\u95f2\u8a00\u788e\u8bed\u4e0d\u591a\u8bb2\uff0c\u5f00\u59cb\u6211\u4eec\u7684\u914d\u7f6e\u4e4b\u65c5\u3002<\/p>\n<p>\u8fd0\u884c\u73af\u5883\uff1a\u817e\u8baf\u4e91 Ubuntu Linux 14.04<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/s1.ax1x.com\/2022\/10\/11\/xN2BZt.jpg\" alt=\"\" width=\"1620\" height=\"893\" \/><\/p>\n<h1 id=\"%E7%BC%96%E5%86%99Shell%E8%84%9A%E6%9C%AC\">\u7f16\u5199Shell\u811a\u672c<\/h1>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u8981\u7f16\u5199\u4e00\u4e2ashell\u811a\u672c\uff0c\u811a\u672c\u4e3b\u8981\u6267\u884c\u7684\u903b\u8f91\u5982\u4e0b\uff1a<\/p>\n<p>\u663e\u793amysqld\u8fdb\u7a0b\u72b6\u6001\uff0c\u5982\u679c\u5224\u65ad\u8fdb\u7a0b\u672a\u5728\u8fd0\u884c\uff0c\u90a3\u4e48\u8f93\u51fa\u65e5\u5fd7\u5230\u6587\u4ef6\uff0c\u7136\u540e\u542f\u52a8mysql\u670d\u52a1\uff0c\u5982\u679c\u8fdb\u7a0b\u5728\u8fd0\u884c\uff0c\u90a3\u4e48\u4e0d\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\uff0c\u53ef\u4ee5\u9009\u62e9\u6027\u8f93\u51fa\u76d1\u6d4b\u7ed3\u679c\u3002<\/p>\n<p>\u53ef\u80fd\u5927\u5bb6\u5bf9\u4e8eshell\u811a\u672c\u6bd4\u8f83\u964c\u751f\uff0c\u5728\u8fd9\u91cc\u63a8\u8350\u5b98\u65b9\u7684shell\u811a\u672c\u6587\u6863\u6765\u53c2\u8003\u4e00\u4e0b<\/p>\n<p><a href=\"http:\/\/wiki.ubuntu.org.cn\/Shell%E7%BC%96%E7%A8%8B%E5%9F%BA%E7%A1%80\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" data-from=\"10680\">Ubuntu Shell \u7f16\u7a0b\u57fa\u7840<\/a><\/p>\n<p>shell\u811a\u672c\u7684\u540e\u7f00\u4e3ash\uff0c\u5728\u4efb\u4f55\u4f4d\u7f6e\u65b0\u5efa\u4e00\u4e2a\u811a\u672c\u6587\u4ef6\uff0c\u6211\u9009\u62e9\u5728 \/etc\/mysql \u76ee\u5f55\u4e0b\u65b0\u5efa\u4e00\u4e2a listen.sh \u6587\u4ef6\u3002<\/p>\n<p>\u6267\u884c\u5982\u4e0b\u547d\u4ee4\uff1a<\/p>\n<ol>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #7a0874; font-weight: bold;\">cd<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #c20cb9; font-weight: bold;\">touch<\/span> listen.sh<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #c20cb9; font-weight: bold;\">vi<\/span> listen.sh<\/div>\n<\/li>\n<\/ol>\n<p>\u8fdb\u5165\u5230vi\u4e2d\uff0c\u6211\u4eec\u6dfb\u52a0\u5982\u4e0b\u811a\u672c\u5185\u5bb9\uff1a<\/p>\n<ol>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #666666; font-style: italic;\">#!\/bin\/bash<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">pgrep mysqld <span style=\"color: #000000; font-weight: bold;\">&amp;&gt;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>dev<span style=\"color: #000000; font-weight: bold;\">\/<\/span>null<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #000000; font-weight: bold;\">if<\/span> <span style=\"color: #7a0874; font-weight: bold;\">[<\/span> <span style=\"color: #007800;\">$?<\/span> <span style=\"color: #660033;\">-gt<\/span> <span style=\"color: #000000;\">0<\/span> <span style=\"color: #7a0874; font-weight: bold;\">]<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #000000; font-weight: bold;\">then<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&#8220;<span style=\"color: #780078;\">`date`<\/span> mysql is stop&#8221;<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">service mysql start<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #000000; font-weight: bold;\">else<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&#8220;<span style=\"color: #780078;\">`date`<\/span> mysql running&#8221;<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #000000; font-weight: bold;\">fi<\/span><\/div>\n<\/li>\n<\/ol>\n<p>\u5176\u4e2d pgrep mysqld \u662f\u76d1\u6d4bmysqld\u670d\u52a1\u7684\u8fd0\u884c\u72b6\u6001\uff0c&amp;&gt; \/dev\/null \u662f\u5c06\u5176\u7ed3\u679c\u8f93\u51fa\u5230\u7a7a\u6587\u4ef6\uff0c\u4e5f\u5c31\u662f\u4e0d\u4fdd\u5b58\u8f93\u51fa\u4fe1\u606f<\/p>\n<p>$? \u662f\u62ff\u5230\u4e0a\u4e00\u6761\u547d\u4ee4\u7684\u8fd0\u884c\u7ed3\u679c\uff0c-gt 0 \u662f\u5224\u65ad\u662f\u5426\u5927\u4e8e0\uff0c\u540e\u9762\u5219\u662f\u8f93\u51fa\u65f6\u95f4\u5230\u65e5\u5fd7\u6587\u4ef6\uff0c\u7136\u540e\u542f\u52a8mysql\uff0c\u5426\u5219\u4e0d\u542f\u52a8mysql<\/p>\n<p>\u4fdd\u5b58\u597d\u4e86\uff0c\u90a3\u4e48\u6211\u4eec\u6267\u884c\u5982\u4e0b\u7684\u547d\u4ee4\uff0c\u6765\u6d4b\u8bd5\u4e00\u4e0b\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/s1.ax1x.com\/2022\/10\/11\/xN2aMd.jpg\" alt=\"\" width=\"461\" height=\"228\" \/><br \/>\n\u8d34\u5fc3\u7684\u547d\u4ee4\u6587\u5b57\u7248\u672c\uff1a<\/p>\n<ol>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">root<span style=\"color: #000000; font-weight: bold;\">@<\/span>iZ28uogb3laZ:<span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql<span style=\"color: #666666; font-style: italic;\"># vi listen.sh<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">root<span style=\"color: #000000; font-weight: bold;\">@<\/span>iZ28uogb3laZ:<span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql<span style=\"color: #666666; font-style: italic;\"># pgrep mysqld<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #000000;\">3359<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">root<span style=\"color: #000000; font-weight: bold;\">@<\/span>iZ28uogb3laZ:<span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql<span style=\"color: #666666; font-style: italic;\"># chmod 777 listen.sh<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">root<span style=\"color: #000000; font-weight: bold;\">@<\/span>iZ28uogb3laZ:<span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql<span style=\"color: #666666; font-style: italic;\"># .\/listen.sh<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:<span style=\"color: #000000;\">44<\/span>:<span style=\"color: #000000;\">58<\/span> CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">root<span style=\"color: #000000; font-weight: bold;\">@<\/span>iZ28uogb3laZ:<span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql<span style=\"color: #666666; font-style: italic;\"># sudo service mysql stop<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">mysql stop<span style=\"color: #000000; font-weight: bold;\">\/<\/span>waiting<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">root<span style=\"color: #000000; font-weight: bold;\">@<\/span>iZ28uogb3laZ:<span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql<span style=\"color: #666666; font-style: italic;\"># .\/listen.sh<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:<span style=\"color: #000000;\">45<\/span>:<span style=\"color: #000000;\">17<\/span> CST <span style=\"color: #000000;\">2015<\/span> mysql is stop<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">mysql start<span style=\"color: #000000; font-weight: bold;\">\/<\/span>running, process <span style=\"color: #000000;\">4084<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">root<span style=\"color: #000000; font-weight: bold;\">@<\/span>iZ28uogb3laZ:<span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql<span style=\"color: #666666; font-style: italic;\"># .\/listen.sh<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:<span style=\"color: #000000;\">45<\/span>:<span style=\"color: #000000;\">24<\/span> CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">root<span style=\"color: #000000; font-weight: bold;\">@<\/span>iZ28uogb3laZ:<span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql<span style=\"color: #666666; font-style: italic;\">#<\/span><\/div>\n<\/li>\n<\/ol>\n<p>\u55ef\uff0c\u7f16\u8f91\u5b8c\u4e86.sh\u6587\u4ef6\u4e4b\u540e\uff0c\u6211\u4eec\u9996\u5148\u8981\u5bf9\u5176\u8fdb\u884c\u6388\u6743\uff0c\u589e\u52a0\u53ef\u6267\u884c\u7684\u6743\u9650\u3002<\/p>\n<ol>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #c20cb9; font-weight: bold;\">sudo<\/span> <span style=\"color: #c20cb9; font-weight: bold;\">chmod<\/span> <span style=\"color: #000000;\">777<\/span> listen.sh<\/div>\n<\/li>\n<\/ol>\n<p>\u7136\u540e\u8fd0\u884c\u811a\u672c\u6d4b\u8bd5\u4e00\u4e0b\uff0c\u663e\u793amysql\u6b63\u5728\u8fd0\u884c\u3002\u628amysql\u5173\u6389\uff0c\u8fd0\u884c\u811a\u672c\uff0c\u4fbf\u4f1a\u68c0\u6d4b\u5230mysql\u5df2\u5173\u95ed\uff0c\u7136\u540e\u91cd\u65b0\u542f\u52a8\u4e86mysql\uff0c\u518d\u6b21\u8fd0\u884c\uff0c\u4fbf\u4f1a\u53d1\u73b0mysql\u6b63\u5e38\u8fd0\u884c\u4e86\u3002<\/p>\n<h1 id=\"%E4%BF%AE%E6%94%B9%E6%97%A5%E5%BF%97%E8%BE%93%E5%87%BA\">\u4fee\u6539\u65e5\u5fd7\u8f93\u51fa<\/h1>\n<p>\u597d\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u628a\u8f93\u51fa\u7684\u5185\u5bb9\u4fdd\u5b58\u5230\u65e5\u5fd7\u91cc\u3002\u4fee\u6539\u811a\u672c\u6587\u4ef6\u5982\u4e0b<\/p>\n<ol>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #666666; font-style: italic;\">#!\/bin\/bash<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">pgrep mysqld <span style=\"color: #000000; font-weight: bold;\">&amp;&gt;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>dev<span style=\"color: #000000; font-weight: bold;\">\/<\/span>null<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #000000; font-weight: bold;\">if<\/span> <span style=\"color: #7a0874; font-weight: bold;\">[<\/span> <span style=\"color: #007800;\">$?<\/span> <span style=\"color: #660033;\">-gt<\/span> <span style=\"color: #000000;\">0<\/span> <span style=\"color: #7a0874; font-weight: bold;\">]<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #000000; font-weight: bold;\">then<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&#8220;<span style=\"color: #780078;\">`date`<\/span> mysql is stop&#8221;<\/span> <span style=\"color: #000000; font-weight: bold;\">&gt;&gt;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>var<span style=\"color: #000000; font-weight: bold;\">\/<\/span>log<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql_listen.log<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">service mysql start<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #000000; font-weight: bold;\">else<\/span><\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #7a0874; font-weight: bold;\">echo<\/span> <span style=\"color: #ff0000;\">&#8220;<span style=\"color: #780078;\">`date`<\/span> mysql running&#8221;<\/span> <span style=\"color: #000000; font-weight: bold;\">&gt;&gt;<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>var<span style=\"color: #000000; font-weight: bold;\">\/<\/span>log<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql_listen.log<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #000000; font-weight: bold;\">fi<\/span><\/div>\n<\/li>\n<\/ol>\n<p>\u8fd9\u6837\uff0c\u6bcf\u6267\u884c\u4e00\u6b21\u811a\u672c\uff0c\u8f93\u51fa\u7ed3\u679c\u90fd\u4f1a\u88ab\u4fdd\u5b58\u5230 \/var\/log\/mysql_listen.log \u4e2d\u4e86\u3002<\/p>\n<h1 id=\"%E6%B7%BB%E5%8A%A0%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1\">\u6dfb\u52a0\u5b9a\u65f6\u4efb\u52a1<\/h1>\n<p>\u597d\u4e86\uff0c\u811a\u672c\u53ef\u4ee5\u987a\u5229\u6267\u884c\u4e86\uff0c\u90a3\u4e48\u6211\u4eec\u5c31\u9700\u8981\u5b9a\u65f6\u8c03\u7528\u4e00\u4e0b\u8fd9\u4e2a\u811a\u672c\u6765\u8fd0\u884c\u4e86\uff0c\u6211\u4eec\u9700\u8981\u7528\u5230 cron\u3002<\/p>\n<p>\u9996\u5148\u6211\u4eec\u9700\u8981\u7f16\u8f91\u4e00\u4e0bcorn\u8c03\u5ea6\u8868\u683c\uff0c\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<ol>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">crontab <span style=\"color: #660033;\">-e<\/span><\/div>\n<\/li>\n<\/ol>\n<p>\u5982\u679c\u4f60\u662f\u7b2c\u4e00\u6b21\u7f16\u8f91\u8fd9\u4e2a\uff0c\u4ed6\u4f1a\u8ba9\u4f60\u9009\u62e9\u6587\u4ef6\u6253\u5f00\u65b9\u5f0f\uff0c\u968f\u4fbf\u9009\u4e00\u4e2a\u6570\u5b57\u5c31\u597d\u4e86\u3002<\/p>\n<p>\u6bd4\u5982\u6211\u4eec\u7528GNU\u6253\u5f00\u7684\uff0c\u6211\u4eec\u5c31\u5728\u5b83\u7684\u6700\u540e\u4e00\u884c\u6dfb\u52a0\u4e0b\u9762\u7684\u4e00\u53e5\u8bdd\u5373\u53ef\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/s1.ax1x.com\/2022\/10\/11\/xN2dsA.jpg\" alt=\"\" width=\"640\" height=\"384\" \/><\/p>\n<p>\u6587\u5b57\u7248\u672c\uff1a<\/p>\n<ol>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\"><span style=\"color: #000000; font-weight: bold;\">*\/<\/span><span style=\"color: #000000;\">5<\/span> <span style=\"color: #000000; font-weight: bold;\">*<\/span> <span style=\"color: #000000; font-weight: bold;\">*<\/span> <span style=\"color: #000000; font-weight: bold;\">*<\/span> <span style=\"color: #000000; font-weight: bold;\">*<\/span> <span style=\"color: #000000; font-weight: bold;\">\/<\/span>etc<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql<span style=\"color: #000000; font-weight: bold;\">\/<\/span>mysql_listen.sh<\/div>\n<\/li>\n<\/ol>\n<p>\/5\u4ee3\u8868\u4e94\u5206\u949f\u6267\u884c\u4e00\u6b21\uff0c\u540e\u9762\u7684\u56db\u4e2a\u70b9\u4f9d\u6b21\u4ee3\u8868\u4e86\uff0c\u5c0f\u65f6\uff0c\u65e5\uff0c\u6708\uff0c\u661f\u671f\u3002\u5982\u679c\u60f3\u8981\u65f6\u95f4\u957f\u4e00\u4e9b\uff0c\u6bd4\u5982\u4e00\u5c0f\u65f6\u8c03\u5ea6\u4e00\u6b21\uff0c\u90a3\u5c31\u8bbe\u7f6e\u4e00\u4e0b\u540e\u9762\u7b2c\u4e00\u4e2a*\u5c31\u597d\u4e86\u3002<\/p>\n<p>\u597d\uff0c\u4fdd\u5b58\u4e00\u4e0b\uff0c\u91cd\u542fcron\u670d\u52a1\u3002<\/p>\n<ol>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">service cron restart<\/div>\n<\/li>\n<\/ol>\n<p>\u55ef\uff0c\u8c03\u5ea6\u4efb\u52a1\u5df2\u7ecf\u6dfb\u52a0\u8fdb\u53bb\u4e86\uff0c\u8fd9\u6837\uff0c\u6bcf\u4e94\u5206\u949f\u7cfb\u7edf\u5c31\u4f1a\u8c03\u7528\u4e00\u4e0b\u521a\u624d\u5199\u7684\u90a3\u4e2a\u811a\u672c\u3002<\/p>\n<p>\u8fc7\u4e00\u6bb5\u65f6\u95f4\uff0c\u6211\u4eec\u6765\u770b\u4e00\u4e0b\u8fd0\u884c\u6548\u679c\uff0c\u55ef\uff0c\u76d1\u63a7\u8dd1\u7684\u5f88\u987a\u5229\u5450\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/s1.ax1x.com\/2022\/10\/11\/xN2wqI.jpg\" alt=\"\" width=\"496\" height=\"261\" \/><\/p>\n<p>\u5185\u5bb9\uff1a<\/p>\n<ol>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">15<\/span>:<span style=\"color: #000000;\">39<\/span>:<span style=\"color: #000000;\">12<\/span> CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">15<\/span>:<span style=\"color: #000000;\">40<\/span>:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">15<\/span>:<span style=\"color: #000000;\">45<\/span>:02 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">15<\/span>:<span style=\"color: #000000;\">50<\/span>:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">15<\/span>:<span style=\"color: #000000;\">55<\/span>:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:00:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:05:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:<span style=\"color: #000000;\">10<\/span>:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:<span style=\"color: #000000;\">15<\/span>:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:<span style=\"color: #000000;\">20<\/span>:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:<span style=\"color: #000000;\">25<\/span>:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:<span style=\"color: #000000;\">30<\/span>:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:<span style=\"color: #000000;\">35<\/span>:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:<span style=\"color: #000000;\">40<\/span>:01 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<li style=\"font-weight: normal; vertical-align: top;\">\n<div style=\"font: normal normal 1em\/1.2em monospace; margin: 0; padding: 0; background: none; vertical-align: top;\">Sun Aug <span style=\"color: #000000;\">16<\/span> <span style=\"color: #000000;\">16<\/span>:<span style=\"color: #000000;\">51<\/span>:04 CST <span style=\"color: #000000;\">2015<\/span> mysql running<\/div>\n<\/li>\n<\/ol>\n<h1 id=\"%E7%BB%93%E8%AF%AD\">\u7ed3\u8bed<\/h1>\n<p>\u8fd9\u6837\uff0c\u6211\u4eec\u5c31\u5b9e\u73b0\u4e86\u4e94\u5206\u949f\u5b9a\u65f6\u68c0\u6d4bMySQL\u8fdb\u7a0b\u670d\u52a1\uff0c\u5988\u5988\u518d\u4e5f\u4e0d\u7528\u62c5\u5fc3\u6211\u7684\u7f51\u7ad9\u4f1a\u5b95\u6389\u5566\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/blog.csdn.net\/qq_3&#46;&#46;&#46;<\/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":[],"class_list":["post-348","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/tianzi.pro\/index.php?rest_route=\/wp\/v2\/posts\/348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tianzi.pro\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tianzi.pro\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tianzi.pro\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tianzi.pro\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=348"}],"version-history":[{"count":7,"href":"https:\/\/tianzi.pro\/index.php?rest_route=\/wp\/v2\/posts\/348\/revisions"}],"predecessor-version":[{"id":355,"href":"https:\/\/tianzi.pro\/index.php?rest_route=\/wp\/v2\/posts\/348\/revisions\/355"}],"wp:attachment":[{"href":"https:\/\/tianzi.pro\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tianzi.pro\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tianzi.pro\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}