\u5728\u672c\u5730\u8fde\u63a5\u5230mysql\u65f6\uff0c\u53ef\u4ee5\u6307\u5b9a\u901a\u8fc7\u54ea\u4e2a\u5957\u63a5\u5b57\u6587\u4ef6\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u901a\u8fc7-S\u6307\u5b9a\u5957\u63a5\u5b57\u4f4d\u7f6e\u3002<\/p>\n
mysql -u root -p -S \/var\/lib\/mysql\/mysql.sock<\/pre>\n\u5728\u8fde\u63a5\u5230mysql\u65f6\uff0c\u53ef\u4ee5\u6307\u5b9a\u8981\u8fde\u63a5\u5230\u8fdc\u7a0b\u7684\u54ea\u4e00\u53f0\u4e3b\u673a\u7684mysql\u4e0a\uff0c\u4e5f\u53ef\u4ee5\u6307\u5b9a\u7aef\u53e3\uff0c-h\u6307\u5b9amysql\u4e3b\u673a\uff0c-P\u5927\u5199\uff0c\u6307\u5b9amysql\u670d\u52a1\u5bf9\u5e94\u7684\u7aef\u53e3\uff0c\u8fde\u63a5\u7684\u524d\u63d0\u662f\u5df2\u7ecf\u6388\u6743\u5f53\u524d\u5ba2\u6237\u7aef\u7684IP\u5730\u5740\u80fd\u591f\u8fde\u63a5\u5230\u6570\u636e\u5e93\u3002<\/p>\n
mysql -u root -p -h 192.168.1.103 -P 3306<\/pre>\n\u8fde\u63a5\u6570\u636e\u5e93\u7684\u540c\u65f6\u6267\u884c\u5bf9\u5e94\u547d\u4ee4\uff0c\u5e76\u4e14\u8fd4\u56de\u547d\u4ee4\u5bf9\u5e94\u7684\u7ed3\u679c\uff0c\u5e76\u4e0d\u4f1a\u8fdb\u5165mysql\u63d0\u793a\u7b26\u3002<\/p>\n
\u793a\u4f8b\u5982\u4e0b\uff0c\u8868\u793a\u8fde\u63a5\u6570\u636e\u5e93\u7684\u540c\u65f6\uff0c\u6267\u884c-e\u9009\u9879\u540e\u9762\u8ddf\u968f\u7684sql\u8bed\u53e5\uff0c\u5e76\u4e14\u8fd4\u56de\u8bed\u53e5\u6267\u884c\u7684\u7ed3\u679c\u3002<\/p>\n
mysql -u root -p123123 -e 'use mysql; select user,host,password from user;'<\/pre>\nmysql -uroot -p123123 -e 'create database if not exists testdb; show databases;'<\/pre>\n\u8fde\u63a5\u6570\u636e\u5e93\u7684\u5e38\u7528\u9009\u9879<\/p>\n
\u2013host=host_name, -h host_name\uff1a\u670d\u52a1\u7aef\u5730\u5740\uff1b\r\n\r\n\u2013user=user_name, -u user_name\uff1a\u7528\u6237\u540d\uff1b\r\n\r\n\u2013port=port_num, -P port_num\uff1a\u670d\u52a1\u7aef\u7aef\u53e3\uff1b\r\n\r\n\u2013socket=path, -S path\r\n\r\n\u2013database=db_name, -D db_name\uff1a\r\n\r\n\u2013compress, -C\uff1a\u6570\u636e\u538b\u7f29\u4f20\u8f93\r\n\r\n\u2013execute=statement, -e statement\uff1a\u975e\u4ea4\u4e92\u6a21\u5f0f\u6267\u884cSQL\u8bed\u53e5\uff1b\r\n\r\n\u2013vertical, -E\uff1a\u67e5\u8be2\u7ed3\u679c\u7eb5\u5411\u663e\u793a\uff1b\r\n\r\n\u2013protocol={TCP|SOCKET|PIPE|MEMORY}\uff1a\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"\u5982\u4e0b\u547d\u4ee4\u8868\u793a\u4f7f\u7528root\u7528\u6237\uff08mysql\u7684root\u7528\u6237\uff0c\u975e\u7cfb\u7edfroot\u7528\u6237\uff09\u8fde\u63a5\u5230mysql\u6570\u636e\u5e93\uff0c-u\u8868\u793a\u6307 […]<\/p>\n","protected":false},"author":1479,"featured_media":212386,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-212382","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1479"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=212382"}],"version-history":[{"count":4,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212382\/revisions"}],"predecessor-version":[{"id":212430,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212382\/revisions\/212430"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/212386"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=212382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=212382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=212382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}