{"id":227,"date":"2025-03-08T08:10:27","date_gmt":"2025-03-08T00:10:27","guid":{"rendered":"https:\/\/www.xxiaoteng.cn\/?p=227"},"modified":"2026-05-11T21:24:30","modified_gmt":"2026-05-11T13:24:30","slug":"%e5%b8%b8%e8%a7%81mysql%e9%94%99%e8%af%af%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"https:\/\/www.xxiaoteng.cn\/?p=227","title":{"rendered":"\u5e38\u89c1MySQL\u9519\u8bef\u89e3\u51b3"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"toc-0\"><strong>\u95ee\u98981\uff1aMySQL\u5b89\u88c5\u540e\uff0c\u5728\/tmp\/mysqld.log\u4e2d\u627e\u4e0d\u5230MySQL\u5bc6\u7801\uff1f<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b54\uff1a\u51fa\u73b0\u4ee5\u4e0a\u95ee\u9898\u7684\u4e3b\u8981\u539f\u56e0\u6709\u4e24\u79cd\u60c5\u51b5\uff1a\u2460 \u8ba1\u7b97\u673a\u672c\u8eab\u5b89\u88c5\u8fc7MySQL\u8f6f\u4ef6\uff0c\u91cd\u590d\u5b89\u88c5\u5bfc\u81f4\u521d\u59cb\u5316\u5931\u8d25 \u2461 \u6570\u636e\u5e93\u914d\u7f6e\u5f02\u5e38\uff0c\u5fd8\u8bb0\u521b\u5efa\u8d26\u53f7\uff0c\u76ee\u5f55\u5f02\u5e38\u7b49\u7b49\u90fd\u53ef\u80fd\u521d\u59cb\u5316\u5931\u8d25\u4e86<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u521d\u59cb\u5316\u6210\u529f\uff0c\u5728MySQL\u5185\u90e8\uff0c\u4f1a\u4ea7\u751f\u4e00\u4e2adata\u76ee\u5f55\uff0c\u91cc\u9762\u6700\u5c11\u8981\u5305\u542bmysql\u6587\u4ef6\u5939\uff08\u5185\u7f6emysql\u6570\u636e\u5e93\uff0c\u5305\u542b\u8d26\u53f7\u3001\u7cfb\u7edf\u7b49\u4fe1\u606f\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >cd \/export\/server\/mysql\nll data\ndrwxr-x--- 2 mysql mysql     4096 Apr 20 14:34 &#039;#innodb_redo&#039;\ndrwxr-x--- 2 mysql mysql      187 Apr 20 14:34 &#039;#innodb_temp&#039;\ndrwxr-x--- 2 mysql mysql      143 Apr 20 11:06  mysql\n-rw-r----- 1 mysql mysql        6 Apr 20 14:34  mysqld.pid\n-rw-r----- 1 mysql mysql 26214400 Apr 20 14:34  mysql.ibd\ndrwxr-x--- 2 mysql mysql     8192 Apr 20 11:06  performance_schema<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u6ca1\u6709\u8fd9\u4e9b\u76ee\u5f55\u6216\u8005\u6587\u4ef6\uff0c\u5c31\u662f\u521d\u59cb\u5316\u5931\u8d25\u4e86\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u89e3\u51b3\u65b9\u6848\uff1a\u5220\u9664data\u76ee\u5f55\uff0c\u7136\u540e\u91cd\u65b0\u521d\u59cb\u5316<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >cd \/export\/server\/mysqlrm -rf databin\/mysqld --initialize --user=mysql --basedir=\/export\/server\/mysql &amp;&gt;\/tmp\/mysqld.log<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-1\">\u95ee\u98982\uff1aMySQL\u8fde\u63a5\u62a5\u9519\uff0cERROR 2002 (HY000): Can't connect to local MySQL server through socket '\/tmp\/mysql.sock' (2)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b54\uff1a\u51fa\u73b0\u4ee5\u4e0a\u95ee\u9898\u7684\u4e3b\u8981\u539f\u56e0\uff0c\u53ef\u80fd\u662fMySQL\u8f6f\u4ef6\u6ca1\u6709\u542f\u52a8 \u6216\u8005 MySQL\u5df2\u7ecf\u5f02\u5e38\u542f\u52a8\uff0c\u4f46\u662f\u6ca1\u6709\u4ea7\u751f\u5957\u63a5\u5b57\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL\u8f6f\u4ef6\u6ca1\u6709\u542f\u52a8<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >systemctl status mysqld\nll \/tmp\nsystemctl start mysqld<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">MySQL\u5df2\u7ecf\u5f02\u5e38\u542f\u52a8\uff0c\u4f46\u662f\u6ca1\u6709\u4ea7\u751f\u5957\u63a5\u5b57<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"prettyprint\" >\u5148\u5c1d\u8bd5\u4f7f\u7528systemctl\u7ec8\u6b62mysqld\u670d\u52a1\nsystemctl stop mysqld\n\n\u5f3a\u5236\u7ec8\u6b62mysqld\uff08\u751f\u4ea7\u73af\u5883\u614e\u7528\uff09\npkill mysqld\n\nsystemctl start mysqld<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"toc-2\">\u95ee\u98983\uff1aMySQL\u767b\u5f55\u62a5\u9519ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b54\uff1a1045\u662f\u4e00\u4e2a\u6bd4\u8f83\u7ecf\u5178\u7684\u62a5\u9519\u7f16\u53f7\uff0c\u4ee3\u8868\u5bc6\u7801\u8f93\u5165\u9519\u8bef\uff0c\u5bc6\u7801\u4e0d\u6b63\u786e\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u95ee\u98984\uff1amysql\u3001mysql-server\u3001mysql.service\u3001\/etc\/my.cnf\u4e4b\u95f4\u5173\u7cfb<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.xxiaoteng.cn\/wp-content\/uploads\/2026\/05\/codeYzk4MzYxNGVjMzU1NWM5MjlkYTEwY2VjOTBjMzZkODJfZE9XOWVnOENXSTJONUJGNjhZbnRwOFRnWWxORXU3VU1fVG9rZW46SDNMQmI1NEo1b3o3WFd4ODRzT2NxdVRzbjVkXzE3Nzg0OTc3MTY6MTc3ODUwMTMxNl9WNA.png\" alt=\"\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u98981\uff1aMySQL\u5b89\u88c5\u540e\uff0c\u5728\/tmp\/mysqld.log\u4e2d\u627e\u4e0d\u5230MySQL\u5bc6\u7801\uff1f \u7b54\uff1a\u51fa\u73b0\u4ee5\u4e0a\u95ee\u9898\u7684\u4e3b\u8981\u539f\u56e0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-227","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/posts\/227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=227"}],"version-history":[{"count":3,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/posts\/227\/revisions"}],"predecessor-version":[{"id":231,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=\/wp\/v2\/posts\/227\/revisions\/231"}],"wp:attachment":[{"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xxiaoteng.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}