{"id":56515,"date":"2025-08-14T19:54:44","date_gmt":"2025-08-14T11:54:44","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/56515.html"},"modified":"2025-08-14T19:54:44","modified_gmt":"2025-08-14T11:54:44","slug":"mysql-%e5%ae%89%e8%a3%85%e9%81%bf%e5%9d%91%e6%8c%87%e5%8d%97%ef%bc%9a%e6%9c%8d%e5%8a%a1%e5%90%af%e5%8a%a8%e4%b8%8e%e7%99%bb%e5%bd%95%e9%97%ae%e9%a2%98%e5%85%a8%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/56515.html","title":{"rendered":"MySQL \u5b89\u88c5\u907f\u5751\u6307\u5357\uff1a\u670d\u52a1\u542f\u52a8\u4e0e\u767b\u5f55\u95ee\u9898\u5168\u89e3\u6790"},"content":{"rendered":"<h2>MySQL \u5b89\u88c5\u907f\u5751\u6307\u5357&#xff1a;\u670d\u52a1\u542f\u52a8\u4e0e\u767b\u5f55\u95ee\u9898\u5168\u89e3\u6790<\/h2>\n<p>MySQL \u4f5c\u4e3a\u6700\u6d41\u884c\u7684\u5173\u7cfb\u578b\u6570\u636e\u5e93\u4e4b\u4e00&#xff0c;\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u96be\u514d\u9047\u5230\u5404\u79cd\u95ee\u9898&#xff0c;\u5c24\u5176\u662f\u670d\u52a1\u542f\u52a8\u5931\u8d25\u548c\u767b\u5f55\u62a5\u9519&#xff0c;\u5e38\u5e38\u8ba9\u521d\u5b66\u8005\u5934\u75bc\u3002\u672c\u6587\u7ed3\u5408\u5b9e\u6218\u7ecf\u9a8c&#xff0c;\u603b\u7ed3\u4e86 MySQL \u5b89\u88c5\u540e\u670d\u52a1\u542f\u52a8\u4e0e\u7528\u6237\u767b\u5f55\u7684\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6848&#xff0c;\u5e2e\u4f60\u5feb\u901f\u6392\u67e5\u6545\u969c&#xff0c;\u987a\u5229\u5f00\u542f\u6570\u636e\u5e93\u4e4b\u65c5\u3002<\/p>\n<h3>\u4e00\u3001\u670d\u52a1\u542f\u52a8\u5e38\u89c1\u95ee\u9898\u4e0e\u89e3\u51b3\u65b9\u6cd5<\/h3>\n<p>MySQL \u5b89\u88c5\u5b8c\u6210\u540e&#xff0c;\u9996\u5148\u9700\u8981\u542f\u52a8\u670d\u52a1\u624d\u80fd\u6b63\u5e38\u4f7f\u7528\u3002\u670d\u52a1\u542f\u52a8\u5931\u8d25\u662f\u6700\u5e38\u89c1\u7684 \u201c\u62e6\u8def\u864e\u201d&#xff0c;\u4e3b\u8981\u96c6\u4e2d\u5728\u8fd9\u51e0\u4e2a\u573a\u666f&#xff1a;<\/p>\n<h4>1. \u670d\u52a1\u672a\u5b89\u88c5\u6216\u5b89\u88c5\u5931\u8d25<\/h4>\n<p>\u73b0\u8c61&#xff1a;\u6267\u884cnet start mysql\u65f6\u63d0\u793a \u201c\u670d\u52a1\u540d\u65e0\u6548\u201d&#xff0c;\u6216\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u63d0\u793a \u201c\u670d\u52a1\u5b89\u88c5\u5931\u8d25\u201d\u3002<\/p>\n<p>\u539f\u56e0&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u5b89\u88c5\u5305\u635f\u574f\u6216\u6743\u9650\u4e0d\u8db3&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u4e4b\u524d\u7684 MySQL \u670d\u52a1\u672a\u5f7b\u5e95\u5378\u8f7d&#xff0c;\u6b8b\u7559\u6ce8\u518c\u8868\u4fe1\u606f\u51b2\u7a81\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u89e3\u51b3\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u624b\u52a8\u5b89\u88c5\u670d\u52a1&#xff1a;<\/li>\n<p>\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26&#xff08;CMD&#xff09;&#xff0c;\u8fdb\u5165 MySQL \u7684bin\u76ee\u5f55&#xff08;\u5982C:\\\\Program Files\\\\MySQL\\\\MySQL Server 8.0\\\\bin&#xff09;&#xff0c;\u6267\u884c&#xff1a;<\/p>\n<p>mysqld <span class=\"token comment\">&#8211;install [\u670d\u52a1\u540d]  # \u670d\u52a1\u540d\u9ed8\u8ba4\u662fmysql&#xff0c;\u53ef\u81ea\u5b9a\u4e49<\/span><\/p>\n<p>\u63d0\u793a \u201cService successfully installed\u201d \u5373\u4e3a\u6210\u529f\u3002<\/p>\n<li>\u5f7b\u5e95\u5378\u8f7d\u6b8b\u7559\u670d\u52a1&#xff1a;<\/li>\n<ul>\n<li>\u82e5\u63d0\u793a \u201c\u670d\u52a1\u5df2\u5b58\u5728\u201d&#xff0c;\u5148\u5220\u9664\u65e7\u670d\u52a1&#xff1a;<\/li>\n<\/ul>\n<p>sc <span class=\"token keyword\">delete<\/span> mysql  <span class=\"token comment\"># \u5220\u9664\u9ed8\u8ba4\u670d\u52a1\u540dmysql<\/span><\/p>\n<ul>\n<li>\u6e05\u7406\u6ce8\u518c\u8868&#xff1a;\u6309\u4e0bWin&#043;R\u8f93\u5165regedit&#xff0c;\u5220\u9664HKEY_LOCAL_MACHINE\\\\SYSTEM\\\\CurrentControlSet\\\\Services\u4e2d\u4e0e MySQL \u76f8\u5173\u7684\u9879\u3002<\/li>\n<\/ul>\n<h4>2. \u7aef\u53e3\u88ab\u5360\u7528<\/h4>\n<p>\u73b0\u8c61&#xff1a;\u670d\u52a1\u542f\u52a8\u540e\u7acb\u5373\u505c\u6b62&#xff0c;\u67e5\u770b\u9519\u8bef\u65e5\u5fd7&#xff08;data\u76ee\u5f55\u4e0b\u7684.err\u6587\u4ef6&#xff09;\u63d0\u793a \u201cPort 3306 is already in use\u201d\u3002<\/p>\n<p>\u539f\u56e0&#xff1a;\u9ed8\u8ba4\u7aef\u53e3 3306 \u88ab\u5176\u4ed6\u7a0b\u5e8f&#xff08;\u5982\u5176\u4ed6 MySQL \u5b9e\u4f8b\u3001Docker \u5bb9\u5668&#xff09;\u5360\u7528\u3002<\/p>\n<p>\u89e3\u51b3\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u67e5\u627e\u5360\u7528\u7a0b\u5e8f&#xff1a;<\/li>\n<p>netstat <span class=\"token operator\">&#8211;<\/span>ano <span class=\"token operator\">|<\/span> findstr <span class=\"token number\">3306<\/span>  <span class=\"token comment\"># \u627e\u5230\u5360\u75283306\u7aef\u53e3\u7684\u8fdb\u7a0bID&#xff08;PID&#xff09;<\/span><\/p>\n<p>\u5728\u4efb\u52a1\u7ba1\u7406\u5668\u4e2d\u7ed3\u675f\u5bf9\u5e94 PID \u7684\u8fdb\u7a0b&#xff08;\u82e5\u4e3a\u65e0\u5173\u7a0b\u5e8f&#xff09;\u3002<\/p>\n<li>\u4fee\u6539 MySQL \u7aef\u53e3&#xff1a;<\/li>\n<p>\u6253\u5f00\u914d\u7f6e\u6587\u4ef6my.ini&#xff08;\u6216my.cnf&#xff09;&#xff0c;\u5728[mysqld]\u4e0b\u6dfb\u52a0&#xff1a;<\/p>\n<p>port<span class=\"token operator\">&#061;<\/span><span class=\"token number\">3307<\/span>  <span class=\"token comment\"># \u6539\u4e3a\u672a\u5360\u7528\u7684\u7aef\u53e3&#xff08;\u59823307&#xff09;<\/span><\/p>\n<p>\u91cd\u542f\u670d\u52a1\u540e&#xff0c;\u767b\u5f55\u65f6\u9700\u6307\u5b9a\u7aef\u53e3&#xff1a;mysql -u root -P 3307 -p\u3002<\/p>\n<h4>3. \u914d\u7f6e\u6587\u4ef6\u9519\u8bef<\/h4>\n<p>\u73b0\u8c61&#xff1a;\u670d\u52a1\u542f\u52a8\u5931\u8d25&#xff0c;\u65e5\u5fd7\u63d0\u793a \u201cUnknown variable\u201d \u6216 \u201cInvalid configuration\u201d\u3002<\/p>\n<p>\u539f\u56e0&#xff1a;my.ini\u914d\u7f6e\u6587\u4ef6\u5b58\u5728\u8bed\u6cd5\u9519\u8bef&#xff08;\u5982\u62fc\u5199\u9519\u8bef\u3001\u53c2\u6570\u503c\u683c\u5f0f\u9519\u8bef&#xff09;\u3002<\/p>\n<p>\u89e3\u51b3\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u68c0\u67e5\u6838\u5fc3\u914d\u7f6e&#xff1a;\u786e\u4fdd[mysqld]\u4e0b\u7684\u57fa\u7840\u914d\u7f6e\u6b63\u786e&#xff1a;<\/li>\n<p>basedir <span class=\"token operator\">&#061;<\/span> C:<span class=\"token operator\">\/<\/span>Program Files<span class=\"token operator\">\/<\/span>MySQL<span class=\"token operator\">\/<\/span>MySQL Server <span class=\"token number\">8.0<\/span>  <span class=\"token comment\"># \u5b89\u88c5\u76ee\u5f55&#xff08;\u6ce8\u610f\u7528\u659c\u6760\/&#xff09;<\/span><br \/>\ndatadir <span class=\"token operator\">&#061;<\/span> C:<span class=\"token operator\">\/<\/span>Program Files<span class=\"token operator\">\/<\/span>MySQL<span class=\"token operator\">\/<\/span>MySQL Server <span class=\"token number\">8.0<\/span><span class=\"token operator\">\/<\/span><span class=\"token keyword\">data<\/span>  <span class=\"token comment\"># \u6570\u636e\u76ee\u5f55<\/span><br \/>\n<span class=\"token keyword\">default<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token keyword\">character<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token keyword\">set<\/span> <span class=\"token operator\">&#061;<\/span> utf8mb4  <span class=\"token comment\"># \u5b57\u7b26\u96c6<\/span><\/p>\n<li>\u6062\u590d\u9ed8\u8ba4\u914d\u7f6e&#xff1a;\u82e5\u65e0\u6cd5\u5b9a\u4f4d\u9519\u8bef&#xff0c;\u53ef\u5220\u9664\u81ea\u5b9a\u4e49\u914d\u7f6e&#xff0c;\u4f7f\u7528\u5b89\u88c5\u5305\u81ea\u5e26\u7684\u9ed8\u8ba4my.ini&#xff08;\u901a\u5e38\u5728ProgramData\u76ee\u5f55\u4e0b&#xff09;\u3002<\/li>\n<h3>\u4e8c\u3001\u7528\u6237\u767b\u5f55\u5e38\u89c1\u9519\u8bef\u4e0e\u89e3\u51b3\u65b9\u6848<\/h3>\n<p>\u670d\u52a1\u542f\u52a8\u6210\u529f\u540e&#xff0c;\u767b\u5f55\u65f6\u53ef\u80fd\u9047\u5230\u5bc6\u7801\u9519\u8bef\u3001\u6743\u9650\u4e0d\u8db3\u7b49\u95ee\u9898&#xff0c;\u4ee5\u4e0b\u662f\u9ad8\u9891\u573a\u666f\u7684\u5904\u7406\u65b9\u6cd5&#xff1a;<\/p>\n<h4>1. \u5bc6\u7801\u9519\u8bef\u6216\u5fd8\u8bb0\u5bc6\u7801<\/h4>\n<p>\u73b0\u8c61&#xff1a;\u767b\u5f55\u63d0\u793a \u201cAccess denied for user \u2018root\u2019&#064;\u2018localhost\u2019 (using password: YES)\u201d\u3002<\/p>\n<p>\u539f\u56e0&#xff1a;\u5bc6\u7801\u8f93\u5165\u9519\u8bef&#xff0c;\u6216\u5b89\u88c5\u65f6\u672a\u8bb0\u5f55\u968f\u673a\u5bc6\u7801&#xff08;MySQL 8.0 &#043; \u9ed8\u8ba4\u751f\u6210\u968f\u673a\u5bc6\u7801&#xff09;\u3002<\/p>\n<p>\u89e3\u51b3\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u91cd\u7f6e root \u5bc6\u7801&#xff1a;<\/li>\n<ul>\n<li>\n<p>\u505c\u6b62\u670d\u52a1&#xff1a;net stop mysql<\/p>\n<\/li>\n<li>\n<p>\u8df3\u8fc7\u6743\u9650\u9a8c\u8bc1\u542f\u52a8&#xff1a;<\/p>\n<\/li>\n<\/ul>\n<p>mysqld <span class=\"token comment\">&#8211;console &#8211;skip-grant-tables &#8211;shared-memory<\/span><\/p>\n<ul>\n<li>\u65b0\u6253\u5f00\u4e00\u4e2a CMD \u7a97\u53e3&#xff0c;\u65e0\u5bc6\u7801\u767b\u5f55&#xff1a;<\/li>\n<\/ul>\n<p>mysql <span class=\"token operator\">&#8211;<\/span>u root  <span class=\"token comment\"># \u76f4\u63a5\u56de\u8f66&#xff0c;\u65e0\u9700\u8f93\u5165\u5bc6\u7801<\/span><\/p>\n<ul>\n<li>\u5237\u65b0\u6743\u9650\u5e76\u4fee\u6539\u5bc6\u7801&#xff08;MySQL 8.0 &#043; \u8bed\u6cd5&#xff09;&#xff1a;<\/li>\n<\/ul>\n<p>FLUSH <span class=\"token keyword\">PRIVILEGES<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\"># \u5237\u65b0\u6743\u9650<\/span><br \/>\n<span class=\"token keyword\">ALTER<\/span> <span class=\"token keyword\">USER<\/span> <span class=\"token string\">&#039;root&#039;<\/span><span class=\"token variable\">&#064;&#039;localhost&#039;<\/span> IDENTIFIED <span class=\"token keyword\">BY<\/span> <span class=\"token string\">&#039;\u65b0\u5bc6\u7801&#039;<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\"># \u65b0\u5bc6\u7801\u9700\u5305\u542b\u5927\u5c0f\u5199\u3001\u6570\u5b57\u548c\u7b26\u53f7<\/span><\/p>\n<ul>\n<li>\u91cd\u542f\u670d\u52a1&#xff1a;\u5173\u95ed\u6240\u6709\u7a97\u53e3&#xff0c;\u6267\u884cnet start mysql&#xff0c;\u7528\u65b0\u5bc6\u7801\u767b\u5f55\u3002<\/li>\n<\/ul>\n<h4>2. \u4e3b\u673a\u8bbf\u95ee\u6743\u9650\u9650\u5236<\/h4>\n<p>\u73b0\u8c61&#xff1a;\u8fdc\u7a0b\u767b\u5f55\u63d0\u793a \u201cAccess denied for user \u2018root\u2019&#064;\u2018192.168.1.100\u2019 (using password: YES)\u201d\u3002<\/p>\n<p>\u539f\u56e0&#xff1a;\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;root \u7528\u6237\u4ec5\u5141\u8bb8localhost&#xff08;\u672c\u5730&#xff09;\u767b\u5f55&#xff0c;\u672a\u6388\u6743\u8fdc\u7a0b\u4e3b\u673a\u8bbf\u95ee\u3002<\/p>\n<p>\u89e3\u51b3\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u672c\u5730\u767b\u5f55 MySQL&#xff1a;<\/li>\n<p>mysql <span class=\"token operator\">&#8211;<\/span>u root <span class=\"token operator\">&#8211;<\/span>p  <span class=\"token comment\"># \u8f93\u5165\u5bc6\u7801\u767b\u5f55<\/span><\/p>\n<li>\u6388\u6743\u8fdc\u7a0b\u8bbf\u95ee&#xff1a;<\/li>\n<p><span class=\"token comment\">&#8212; \u5141\u8bb8root\u4ece\u4efb\u610f\u4e3b\u673a\u767b\u5f55&#xff08;\u751f\u4ea7\u73af\u5883\u4e0d\u5efa\u8bae&#xff0c;\u53ef\u6307\u5b9a\u5177\u4f53IP\u5982192.168.1.%&#xff09;<\/span><br \/>\n<span class=\"token keyword\">CREATE<\/span> <span class=\"token keyword\">USER<\/span> <span class=\"token string\">&#039;root&#039;<\/span><span class=\"token variable\">&#064;&#039;%&#039;<\/span> IDENTIFIED <span class=\"token keyword\">BY<\/span> <span class=\"token string\">&#039;\u5bc6\u7801&#039;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">GRANT<\/span> <span class=\"token keyword\">ALL<\/span> <span class=\"token keyword\">PRIVILEGES<\/span> <span class=\"token keyword\">ON<\/span> <span class=\"token operator\">*<\/span><span class=\"token punctuation\">.<\/span><span class=\"token operator\">*<\/span> <span class=\"token keyword\">TO<\/span> <span class=\"token string\">&#039;root&#039;<\/span><span class=\"token variable\">&#064;&#039;%&#039;<\/span> <span class=\"token keyword\">WITH<\/span> <span class=\"token keyword\">GRANT<\/span> <span class=\"token keyword\">OPTION<\/span><span class=\"token punctuation\">;<\/span><br \/>\nFLUSH <span class=\"token keyword\">PRIVILEGES<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\"># \u5237\u65b0\u6743\u9650<\/span><\/p>\n<h4>3. \u5b57\u7b26\u96c6\u6216\u7f16\u7801\u9519\u8bef<\/h4>\n<p>\u73b0\u8c61&#xff1a;\u767b\u5f55\u540e\u6267\u884c SQL \u63d0\u793a \u201cIllegal mix of collations\u201d&#xff0c;\u6216\u4e2d\u6587\u663e\u793a\u4e71\u7801\u3002<\/p>\n<p>\u539f\u56e0&#xff1a;\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u5b57\u7b26\u96c6\u4e0d\u4e00\u81f4\u3002<\/p>\n<p>\u89e3\u51b3\u6b65\u9aa4&#xff1a;<\/p>\n<li>\u67e5\u770b\u670d\u52a1\u5668\u5b57\u7b26\u96c6&#xff1a;<\/li>\n<p><span class=\"token keyword\">SHOW<\/span> VARIABLES <span class=\"token operator\">LIKE<\/span> <span class=\"token string\">&#039;character_set_%&#039;<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<li>\u7edf\u4e00\u5b57\u7b26\u96c6&#xff1a;\u5728my.ini\u4e2d\u6dfb\u52a0&#xff1a;<\/li>\n<p><span class=\"token punctuation\">[<\/span>mysqld<span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token keyword\">character<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token keyword\">set<\/span><span class=\"token operator\">&#8211;<\/span>server <span class=\"token operator\">&#061;<\/span> utf8mb4<br \/>\ncollation<span class=\"token operator\">&#8211;<\/span>server <span class=\"token operator\">&#061;<\/span> utf8mb4_unicode_ci<\/p>\n<p><span class=\"token punctuation\">[<\/span>client<span class=\"token punctuation\">]<\/span><br \/>\n<span class=\"token keyword\">default<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token keyword\">character<\/span><span class=\"token operator\">&#8211;<\/span><span class=\"token keyword\">set<\/span> <span class=\"token operator\">&#061;<\/span> utf8mb4<\/p>\n<p>\u91cd\u542f\u670d\u52a1\u540e\u751f\u6548\u3002<\/p>\n<h3>\u4e09\u3001\u6700\u4f73\u5b9e\u8df5&#xff1a;\u907f\u514d\u95ee\u9898\u7684\u9884\u9632\u63aa\u65bd<\/h3>\n<li>\u5b89\u88c5\u65f6\u6ce8\u610f\u4e8b\u9879&#xff1a;<\/li>\n<ul>\n<li>\n<p>\u9009\u62e9 \u201cCustom\u201d \u81ea\u5b9a\u4e49\u5b89\u88c5&#xff0c;\u660e\u786e\u8bb0\u5f55basedir\u548cdatadir\u8def\u5f84&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u82e5\u4e3a MySQL 8.0&#043;&#xff0c;\u5b89\u88c5\u540e\u53ca\u65f6\u8bb0\u5f55\u4e34\u65f6\u5bc6\u7801&#xff08;\u5728data\u76ee\u5f55\u7684.err\u6587\u4ef6\u4e2d&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<li>\u914d\u7f6e\u6587\u4ef6\u7ba1\u7406&#xff1a;<\/li>\n<ul>\n<li>\n<p>\u5907\u4efdmy.ini&#xff0c;\u4fee\u6539\u524d\u590d\u5236\u4e00\u4efd\u526f\u672c&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u8def\u5f84\u4f7f\u7528\u659c\u6760\/\u800c\u975e\u53cd\u659c\u6760\\\\&#xff08;\u907f\u514d\u8f6c\u4e49\u5b57\u7b26\u95ee\u9898&#xff09;\u3002<\/p>\n<\/li>\n<\/ul>\n<li>\u670d\u52a1\u4e0e\u7aef\u53e3\u7ba1\u7406&#xff1a;<\/li>\n<ul>\n<li>\n<p>\u5b9a\u671f\u68c0\u67e5 3306 \u7aef\u53e3\u5360\u7528\u60c5\u51b5&#xff0c;\u907f\u514d\u4e0e\u5176\u4ed6\u7a0b\u5e8f\u51b2\u7a81&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u975e\u5fc5\u8981\u4e0d\u5f00\u653e root \u7528\u6237\u8fdc\u7a0b\u8bbf\u95ee&#xff0c;\u521b\u5efa\u4e13\u7528\u7528\u6237\u5e76\u5206\u914d\u6700\u5c0f\u6743\u9650\u3002<\/p>\n<\/li>\n<\/ul>\n<li>\u5bc6\u7801\u7ba1\u7406&#xff1a;<\/li>\n<ul>\n<li>\n<p>\u4f7f\u7528\u5f3a\u5bc6\u7801&#xff08;\u957f\u5ea6\u22658 \u4f4d&#xff0c;\u5305\u542b\u5927\u5c0f\u5199\u3001\u6570\u5b57\u548c\u7279\u6b8a\u7b26\u53f7&#xff09;&#xff1b;<\/p>\n<\/li>\n<li>\n<p>\u5b9a\u671f\u901a\u8fc7ALTER USER\u547d\u4ee4\u4fee\u6539\u5bc6\u7801&#xff0c;\u907f\u514d\u660e\u6587\u5b58\u50a8\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>\u603b\u7ed3<\/h3>\n<p>MySQL \u670d\u52a1\u542f\u52a8\u4e0e\u767b\u5f55\u95ee\u9898\u591a\u6e90\u4e8e\u914d\u7f6e\u9519\u8bef\u3001\u8d44\u6e90\u51b2\u7a81\u6216\u6743\u9650\u8bbe\u7f6e&#xff0c;\u89e3\u51b3\u7684\u6838\u5fc3\u662f&#xff1a;\u5584\u7528\u9519\u8bef\u65e5\u5fd7\u5b9a\u4f4d\u539f\u56e0&#xff0c;\u901a\u8fc7\u89c4\u8303\u914d\u7f6e\u548c\u6743\u9650\u7ba1\u7406\u9884\u9632\u95ee\u9898\u3002\u672c\u6587\u6db5\u76d6\u7684\u573a\u666f\u548c\u65b9\u6cd5\u9002\u7528\u4e8e MySQL 5.7 \u548c 8.0 \u7248\u672c&#xff0c;\u9047\u5230\u95ee\u9898\u65f6\u5148\u67e5\u770bdata\u76ee\u5f55\u4e0b\u7684\u9519\u8bef\u65e5\u5fd7&#xff08;.err\u6587\u4ef6&#xff09;&#xff0c;\u5927\u90e8\u5206\u6545\u969c\u90fd\u80fd\u4ece\u4e2d\u627e\u5230\u7ebf\u7d22\u3002<\/p>\n<p>\u638c\u63e1\u8fd9\u4e9b\u6280\u5de7\u540e&#xff0c;\u4e0d\u4ec5\u80fd\u5feb\u901f\u89e3\u51b3\u5b89\u88c5\u540e\u7684\u95ee\u9898&#xff0c;\u66f4\u80fd\u57f9\u517b\u6392\u67e5\u6570\u636e\u5e93\u6545\u969c\u7684\u601d\u8def&#xff0c;\u4e3a\u540e\u7eed\u7684 MySQL \u5b66\u4e60\u548c\u4f7f\u7528\u6253\u4e0b\u575a\u5b9e\u57fa\u7840\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb164\u6b21\uff0c\u70b9\u8d5e8\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u672c\u6587\u603b\u7ed3\u4e86MySQL\u5b89\u88c5\u540e\u670d\u52a1\u542f\u52a8\u4e0e\u7528\u6237\u767b\u5f55\u7684\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6848\u3002\u670d\u52a1\u542f\u52a8\u95ee\u9898\u4e3b\u8981\u6d89\u53ca\u670d\u52a1\u5b89\u88c5\u5931\u8d25\u3001\u7aef\u53e3\u5360\u7528\u548c\u914d\u7f6e\u9519\u8bef\uff0c\u53ef\u901a\u8fc7\u624b\u52a8\u5b89\u88c5\u670d\u52a1\u3001\u4fee\u6539\u7aef\u53e3\u53f7\u548c\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u89e3\u51b3\u3002\u767b\u5f55\u95ee\u9898\u5219\u5305\u62ec\u5bc6\u7801\u9519\u8bef\u3001\u8fdc\u7a0b\u8bbf\u95ee\u9650\u5236\u548c\u5b57\u7b26\u96c6\u51b2\u7a81\uff0c\u9700\u8981\u901a\u8fc7\u91cd\u7f6e\u5bc6\u7801\u3001\u6388\u6743\u8fdc\u7a0b\u8bbf\u95ee\u548c\u7edf\u4e00\u5b57\u7b26\u96c6\u6765\u5904\u7406\u3002\u6587\u7ae0\u8fd8\u63d0\u4f9b\u4e86\u5b89\u88c5\u65f6\u7684\u9884\u9632\u63aa\u65bd\u5efa\u8bae\uff0c\u5982\u8bb0\u5f55\u5b89\u88c5\u8def\u5f84\u3001\u5907\u4efd\u914d\u7f6e\u6587\u4ef6\u548c\u52a0\u5f3a\u5bc6\u7801\u7ba1\u7406\u3002\u638c\u63e1\u8fd9\u4e9b\u6392\u67e5\u6280\u5de7\u80fd\u5e2e\u52a9\u7528\u6237\u5feb\u901f\u89e3\u51b3MySQL\u5b89\u88c5\u540e\u7684\u5404\u7c7b\u95ee\u9898\u3002<\/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":[116,84,114,768],"topic":[],"class_list":["post-56515","post","type-post","status-publish","format-standard","hentry","category-server","tag-adb","tag-android","tag-mysql","tag-sql"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>MySQL \u5b89\u88c5\u907f\u5751\u6307\u5357\uff1a\u670d\u52a1\u542f\u52a8\u4e0e\u767b\u5f55\u95ee\u9898\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/56515.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"MySQL \u5b89\u88c5\u907f\u5751\u6307\u5357\uff1a\u670d\u52a1\u542f\u52a8\u4e0e\u767b\u5f55\u95ee\u9898\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb164\u6b21\uff0c\u70b9\u8d5e8\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u672c\u6587\u603b\u7ed3\u4e86MySQL\u5b89\u88c5\u540e\u670d\u52a1\u542f\u52a8\u4e0e\u7528\u6237\u767b\u5f55\u7684\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6848\u3002\u670d\u52a1\u542f\u52a8\u95ee\u9898\u4e3b\u8981\u6d89\u53ca\u670d\u52a1\u5b89\u88c5\u5931\u8d25\u3001\u7aef\u53e3\u5360\u7528\u548c\u914d\u7f6e\u9519\u8bef\uff0c\u53ef\u901a\u8fc7\u624b\u52a8\u5b89\u88c5\u670d\u52a1\u3001\u4fee\u6539\u7aef\u53e3\u53f7\u548c\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u89e3\u51b3\u3002\u767b\u5f55\u95ee\u9898\u5219\u5305\u62ec\u5bc6\u7801\u9519\u8bef\u3001\u8fdc\u7a0b\u8bbf\u95ee\u9650\u5236\u548c\u5b57\u7b26\u96c6\u51b2\u7a81\uff0c\u9700\u8981\u901a\u8fc7\u91cd\u7f6e\u5bc6\u7801\u3001\u6388\u6743\u8fdc\u7a0b\u8bbf\u95ee\u548c\u7edf\u4e00\u5b57\u7b26\u96c6\u6765\u5904\u7406\u3002\u6587\u7ae0\u8fd8\u63d0\u4f9b\u4e86\u5b89\u88c5\u65f6\u7684\u9884\u9632\u63aa\u65bd\u5efa\u8bae\uff0c\u5982\u8bb0\u5f55\u5b89\u88c5\u8def\u5f84\u3001\u5907\u4efd\u914d\u7f6e\u6587\u4ef6\u548c\u52a0\u5f3a\u5bc6\u7801\u7ba1\u7406\u3002\u638c\u63e1\u8fd9\u4e9b\u6392\u67e5\u6280\u5de7\u80fd\u5e2e\u52a9\u7528\u6237\u5feb\u901f\u89e3\u51b3MySQL\u5b89\u88c5\u540e\u7684\u5404\u7c7b\u95ee\u9898\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/56515.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-14T11:54:44+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/56515.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/56515.html\",\"name\":\"MySQL \u5b89\u88c5\u907f\u5751\u6307\u5357\uff1a\u670d\u52a1\u542f\u52a8\u4e0e\u767b\u5f55\u95ee\u9898\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-14T11:54:44+00:00\",\"dateModified\":\"2025-08-14T11:54:44+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/56515.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/56515.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/56515.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MySQL \u5b89\u88c5\u907f\u5751\u6307\u5357\uff1a\u670d\u52a1\u542f\u52a8\u4e0e\u767b\u5f55\u95ee\u9898\u5168\u89e3\u6790\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"MySQL \u5b89\u88c5\u907f\u5751\u6307\u5357\uff1a\u670d\u52a1\u542f\u52a8\u4e0e\u767b\u5f55\u95ee\u9898\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/56515.html","og_locale":"zh_CN","og_type":"article","og_title":"MySQL \u5b89\u88c5\u907f\u5751\u6307\u5357\uff1a\u670d\u52a1\u542f\u52a8\u4e0e\u767b\u5f55\u95ee\u9898\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb164\u6b21\uff0c\u70b9\u8d5e8\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u672c\u6587\u603b\u7ed3\u4e86MySQL\u5b89\u88c5\u540e\u670d\u52a1\u542f\u52a8\u4e0e\u7528\u6237\u767b\u5f55\u7684\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6848\u3002\u670d\u52a1\u542f\u52a8\u95ee\u9898\u4e3b\u8981\u6d89\u53ca\u670d\u52a1\u5b89\u88c5\u5931\u8d25\u3001\u7aef\u53e3\u5360\u7528\u548c\u914d\u7f6e\u9519\u8bef\uff0c\u53ef\u901a\u8fc7\u624b\u52a8\u5b89\u88c5\u670d\u52a1\u3001\u4fee\u6539\u7aef\u53e3\u53f7\u548c\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u89e3\u51b3\u3002\u767b\u5f55\u95ee\u9898\u5219\u5305\u62ec\u5bc6\u7801\u9519\u8bef\u3001\u8fdc\u7a0b\u8bbf\u95ee\u9650\u5236\u548c\u5b57\u7b26\u96c6\u51b2\u7a81\uff0c\u9700\u8981\u901a\u8fc7\u91cd\u7f6e\u5bc6\u7801\u3001\u6388\u6743\u8fdc\u7a0b\u8bbf\u95ee\u548c\u7edf\u4e00\u5b57\u7b26\u96c6\u6765\u5904\u7406\u3002\u6587\u7ae0\u8fd8\u63d0\u4f9b\u4e86\u5b89\u88c5\u65f6\u7684\u9884\u9632\u63aa\u65bd\u5efa\u8bae\uff0c\u5982\u8bb0\u5f55\u5b89\u88c5\u8def\u5f84\u3001\u5907\u4efd\u914d\u7f6e\u6587\u4ef6\u548c\u52a0\u5f3a\u5bc6\u7801\u7ba1\u7406\u3002\u638c\u63e1\u8fd9\u4e9b\u6392\u67e5\u6280\u5de7\u80fd\u5e2e\u52a9\u7528\u6237\u5feb\u901f\u89e3\u51b3MySQL\u5b89\u88c5\u540e\u7684\u5404\u7c7b\u95ee\u9898\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/56515.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-14T11:54:44+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/56515.html","url":"https:\/\/www.wsisp.com\/helps\/56515.html","name":"MySQL \u5b89\u88c5\u907f\u5751\u6307\u5357\uff1a\u670d\u52a1\u542f\u52a8\u4e0e\u767b\u5f55\u95ee\u9898\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-14T11:54:44+00:00","dateModified":"2025-08-14T11:54:44+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/56515.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/56515.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/56515.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"MySQL \u5b89\u88c5\u907f\u5751\u6307\u5357\uff1a\u670d\u52a1\u542f\u52a8\u4e0e\u767b\u5f55\u95ee\u9898\u5168\u89e3\u6790"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/56515","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=56515"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/56515\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=56515"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=56515"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=56515"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=56515"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}