{"id":1726,"date":"2023-03-26T19:50:06","date_gmt":"2023-03-26T11:50:06","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1726"},"modified":"2023-04-23T21:34:42","modified_gmt":"2023-04-23T13:34:42","slug":"mysql-mysqld-safe-launch-details","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/26\/mysql-mysqld-safe-launch-details\/","title":{"rendered":"MySQL\u4e4bmysqld_safe\u542f\u52a8\u8be6\u89e3"},"content":{"rendered":"<h2>mysqld_safe\u547d\u4ee4<\/h2>\n<p><code>mysqld_safe<\/code>\u662f\u5728Unix\u4e0a\u542f\u52a8mysqld\u670d\u52a1\u5668\u7684\u63a8\u8350\u65b9\u6cd5\u3002<code>mysqld_safe<\/code>\u589e\u52a0\u4e86\u4e00\u4e9b\u5b89\u5168\u7279\u6027\uff0c\u4f8b\u5982\u5728\u53d1\u751f\u9519\u8bef\u65f6\u91cd\u65b0\u542f\u52a8\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u8fd0\u884c\u65f6\u4fe1\u606f\u8bb0\u5f55\u5230\u9519\u8bef\u65e5\u5fd7\u3002<\/p>\n<p>\u7528\u6cd5\uff1a<\/p>\n<p><!-- more --><\/p>\n<pre><code class=\"language-bash\">mysqld_safe [OPTIONS]<\/code><\/pre>\n<p>\u53c2\u6570\u89e3\u91ca\uff1a<\/p>\n<pre><code class=\"language-bash\">--help                              # \u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u5e76\u9000\u51fa\n--basedir                           # mysql\u7684\u5b89\u88c5\u8def\u5f84\n--datadir                           # \u6570\u636e\u7684\u5b58\u653e\u8def\u5f84\n--no-defaults                       # \u4e0d\u8bfb\u53d6\u7cfb\u7edf\u9ed8\u8ba4\u6587\u4ef6\n--defaults-file=FILE                # \u4f7f\u7528\u5236\u5b9a\u7684\u9ed8\u8ba4\u6587\u4ef6\n--defaults-extra-file=FILE          # \u540c\u65f6\u4f7f\u7528\u6307\u5b9a\u6587\u4ef6\u7684\u9ed8\u8ba4\u503c\n--ledir=DIRECTORY                   # \u5728\u6307\u5b9a\u76ee\u5f55\u4e2d\u67e5\u627emysqld\n--open-files-limit=LIMIT            # \u9650\u5236\u6253\u5f00\u7684\u6587\u4ef6\u6570\n--core-file-size=LIMIT              # \u5c06\u6838\u5fc3\u6587\u4ef6\u9650\u5236\u4e3a\u6307\u5b9a\u7684\u5927\u5c0f\n--timezone=TZ                       # \u8bbe\u7f6e\u7cfb\u7edf\u65f6\u533a\n--malloc-lib=LIB                    # \u9884\u52a0\u8f7d\u5171\u4eab\u5e93(\u5982\u679c\u53ef\u7528)\n--mysqld=FILE                       # \u4f7f\u7528\u6307\u5b9a\u7684\u6587\u4ef6\u4f5c\u4e3amysqld\n--mysqld-version=VERSION            # \u4f7f\u7528mysql-version\u4f5c\u4e3amysqld\n--nice=NICE                         # \u8bbe\u7f6emysqld\u7684\u8c03\u5ea6\u4f18\u5148\u7ea7\n--plugin-dir=DIR                    # \u63d2\u4ef6\u5728dir\u6216dir\/version\u4e0b\uff0c\u5982\u679c\u7ed9\u51fa\u4e86\u7248\u672c\n--skip-kill-mysqld                  # \u4e0d\u8981\u8bd5\u56fe\u6740\u6b7b\u591a\u4f59\u7684mysqld\u8fdb\u7a0b\n--syslog                            # \u4f7f\u7528&quot;logger&quot;\u5c06\u6d88\u606f\u8bb0\u5f55\u5230syslog\n--skip-syslog                       # \u5c06\u6d88\u606f\u8bb0\u5f55\u5230\u9519\u8bef\u65e5\u5fd7\uff08\u9ed8\u8ba4\uff09\n--syslog-tag=TAG                    # \u5c06-t &quot;mysqld tag&quot;\u4f20\u9012\u7ed9&quot;logger&quot;\n--mysqld-safe-log-timestamps=TYPE   # \u7c7b\u578b\u5fc5\u987b\u662f\u4e00\u4e2a\u56fd\u9645\u6807\u51c6\uff08ISO 8601 UTC\uff09<\/code><\/pre>\n<p>\u5b9e\u4f8b\uff1a<\/p>\n<p>1\u3001\u4f7f\u7528<code>mysqld_safe<\/code>\u542f\u52a8MySQL\u6570\u636e\u5e93<\/p>\n<pre><code class=\"language-bash\">$ mysqld_safe --basedir=\/usr\/local\/mysql\/ --datadir=\/data\/mysql\/data\/ &amp;<\/code><\/pre>\n<p>2\u3001<code>mysqld_safe<\/code>\u901a\u8fc7\u914d\u7f6e\u6587\u4ef6\u542f\u52a8MySQL\u6570\u636e\u5e93<\/p>\n<pre><code class=\"language-bash\">$ mysqld_safe --defaults-file=\/etc\/my.cnf --user=mysql &amp;<\/code><\/pre>\n<p>3\u3001<code>mysqld_safe<\/code>\u901a\u8fc7\u6307\u5b9apid\u6587\u4ef6\u542f\u52a8MySQL\u6570\u636e\u5e93<\/p>\n<pre><code class=\"language-bash\">$ vim \/var\/lib\/mysql\/ali-web-mysql.pid  #\u81ea\u5b9a\u4e49pid\u6570\u5b57\uff0c\u59826666\n\n$ \/bin\/sh \/home\/yezhou\/mysql-8.0.22-linux-glibc2.12-x86_64\/bin\/mysqld_safe --datadir=\/var\/lib\/mysql --pid-file=\/var\/lib\/mysql\/ali-web-mysql.pid &amp;<\/code><\/pre>\n<p><code>mysqld_safe<\/code>\u7684\u9ed8\u8ba4\u542f\u52a8<code>mysqld<\/code>\u7684\u811a\u672c\uff1a<\/p>\n<pre><code class=\"language-bash\">\/home\/yezhou\/mysql-8.0.22-linux-glibc2.12-x86_64\/bin\/mysqld --basedir=\/home\/yezhou\/mysql-8.0.22-linux-glibc2.12-x86_64 --datadir=\/var\/lib\/mysql --plugin-dir=\/home\/yezhou\/mysql-8.0.22-linux-glibc2.12-x86_64\/lib\/plugin --user=mysql --log-error=\/var\/log\/mariadb\/mariadb.log --pid-file=\/var\/lib\/mysql\/ali-web-mysql.pid --socket=\/var\/lib\/mysql\/mysql.sock --port=3306<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>mysqld_safe\u547d\u4ee4 mysqld_safe\u662f\u5728Unix\u4e0a\u542f\u52a8mysqld\u670d\u52a1\u5668\u7684\u63a8\u8350\u65b9\u6cd5\u3002mysqld [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-1726","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1726"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1726\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}