{"id":1777,"date":"2026-02-20T08:42:27","date_gmt":"2026-02-20T00:42:27","guid":{"rendered":"http:\/\/www.dxQerp.cn\/?p=1777"},"modified":"2026-02-20T08:45:50","modified_gmt":"2026-02-20T00:45:50","slug":"error-1396-hy000-operation-create-user-failed-for-roundcubelocalhost","status":"publish","type":"post","link":"http:\/\/www.dxQerp.cn\/?p=1777","title":{"rendered":"ERROR 1396 (HY000): Operation CREATE USER failed for &#8217;roundcube&#8217;@&#8217;localhost&#8217;"},"content":{"rendered":"<p>\u5728 MariaDB \/ MySQL \u4e2d\u6700\u5e38\u898b\u7684\u539f\u56e0\u5c31\u662f\uff1a\u9019\u500b\u5e33\u865f\u5176\u5be6\u5df2\u7d93\u5b58\u5728\uff0c\u53ea\u662f\u4f60\u7528 SELECT \u6216\u8089\u773c\u770b\u7684\u6642\u5019\u6c92\u767c\u73fe\u3002<br \/>\n\u5e38\u898b\u7684\u5e7e\u7a2e\u96b1\u85cf\u60c5\u6cc1\uff1a<\/p>\n<p>\u5e33\u865f\u771f\u7684\u5b58\u5728\uff08\u6700\u5e38\u898b\uff09<br \/>\n\u4e4b\u524d\u624b\u52d5\u522a\u9664\u904e\uff0c\u4f46\u53ea\u522a\u4e86 mysql.user \u537b\u6c92 FLUSH PRIVILEGES;<br \/>\n\u5e33\u865f\u5728 mysql.db\u3001mysql.tables_priv \u7b49\u5176\u4ed6\u6b0a\u9650\u8868\u6709\u6b98\u7559\u7d00\u9304\uff0c\u4f46 mysql.user \u6c92\u6709\uff08dump \u9084\u539f\u6216\u624b\u52d5\u641e\u4e82\u6642\u6703\u767c\u751f\uff09<br \/>\n\u6975\u5c11\u6578\u60c5\u6cc1\u662f\u6b0a\u9650\u8868\u640d\u58de\u6216 replication \u4e0d\u4e00\u81f4<\/p>\n<p>&nbsp;<\/p>\n<h3 dir=\"auto\">\u5efa\u8b70\u4e00\u6b65\u4e00\u6b65\u8655\u7406\uff08\u5f9e\u6700\u7c21\u55ae\u958b\u59cb\uff09<\/h3>\n<p dir=\"auto\">\u8acb\u4f9d\u5e8f\u57f7\u884c\u4ee5\u4e0b\u6307\u4ee4\uff08\u8981\u5728\u6709\u7ba1\u7406\u6b0a\u9650\u7684\u5e33\u865f\u4e0b\uff0c\u4f8b\u5982 root\uff09\uff1a<\/p>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>SQL<\/div>\n<div>\n<pre tabindex=\"0\"><code>-- \u6b65\u9a5f 1\uff1a\u5148\u78ba\u8a8d\u5230\u5e95\u5b58\u4e0d\u5b58\u5728\r\nSELECT User, Host, authentication_string \r\nFROM mysql.user \r\nWHERE User = 'roundcube' AND Host = 'localhost';<\/code><\/pre>\n<\/div>\n<div>\u5982\u679c\u6709\u4efb\u4f55\u4e00\u884c \u2192 \u4ee3\u8868\u5e33\u865f\u5b58\u5728 \u2192 \u76f4\u63a5\u8df3\u5230\u6b65\u9a5f 3<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p dir=\"auto\">\u5982\u679c\u5b8c\u5168\u6c92\u8cc7\u6599 \u2192 \u7e7c\u7e8c\u5f80\u4e0b<\/p>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>SQL<\/div>\n<div>\n<pre tabindex=\"0\"><code>-- \u6b65\u9a5f 2\uff1a\u518d\u6aa2\u67e5\u5176\u4ed6\u6b0a\u9650\u8868\u6709\u6c92\u6709\u6b98\u9ab8\uff08\u5e38\u898b\u65bc roundcube \u5b89\u88dd\u5931\u6557\u5f8c\uff09\r\nSELECT * FROM mysql.db         WHERE User = 'roundcube';\r\nSELECT * FROM mysql.tables_priv WHERE User = 'roundcube';\r\nSELECT * FROM mysql.columns_priv WHERE User = 'roundcube';<\/code><\/pre>\n<\/div>\n<div>\u5982\u679c\u4e0a\u9762\u6709\u8cc7\u6599 \u2192 \u4ee3\u8868\u6709\u300c\u6b98\u7559\u6b0a\u9650\u300d \u2192 \u9700\u8981\u5148\u6e05\u9664<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>SQL<\/div>\n<div>\n<pre tabindex=\"0\"><code>-- \u6b65\u9a5f 3\uff1a\u5f37\u5236\u522a\u9664\uff08\u6700\u4fdd\u96aa\u7684\u505a\u6cd5\uff09\r\nDROP USER IF EXISTS 'roundcube'@'localhost';\r\nFLUSH PRIVILEGES;<\/code><\/pre>\n<\/div>\n<div>\u522a\u5b8c\u5f8c\u518d\u99ac\u4e0a\u8a66\u4e00\u6b21\u5efa\u7acb\uff1a<\/div>\n<div><\/div>\n<\/div>\n<div>\u5982\u679c\u9084\u662f\u5931\u6557\uff08\u6bd4\u8f03\u5c11\u898b\uff09<br \/>\n\u518d\u57f7\u884c\u4e00\u6b21\u66f4\u5fb9\u5e95\u7684\u6e05\u7406\uff1a<br \/>\nSQL&#8211; \u522a\u9664\u6240\u6709\u76f8\u95dc\u6b98\u7559<br \/>\nDROP USER IF EXISTS &#8217;roundcube&#8217;@&#8217;localhost&#8217;;<br \/>\nDELETE FROM mysql.user WHERE User = &#8217;roundcube&#8217; AND Host = &#8216;localhost&#8217;;<br \/>\nDELETE FROM mysql.db WHERE User = &#8217;roundcube&#8217;;<br \/>\nDELETE FROM mysql.tables_priv WHERE User = &#8217;roundcube&#8217;;<br \/>\nDELETE FROM mysql.columns_priv WHERE User = &#8217;roundcube&#8217;;<br \/>\nFLUSH PRIVILEGES;<\/div>\n<\/div>\n<div>\n<h3 dir=\"auto\">\u984d\u5916\u5efa\u8b70\uff08\u5c24\u5176\u662f roundcube \u5b89\u88dd\u6642\uff09<\/h3>\n<p dir=\"auto\">Roundcube \u5b98\u65b9\u5b89\u88dd\u5efa\u8b70\u7684\u8a9e\u6cd5\u901a\u5e38\u662f\u9019\u6a23\u5beb\u7684\uff08\u6bd4\u8f03\u5b89\u5168\uff09\uff1a<\/p>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>SQL<\/div>\n<div>\n<pre tabindex=\"0\"><code>CREATE USER 'roundcube'@'localhost' IDENTIFIED BY '??????????????????????????????';\r\nGRANT ALL PRIVILEGES ON roundcubemail.* TO 'roundcube'@'localhost';\r\nFLUSH PRIVILEGES;<\/code><\/pre>\n<\/div>\n<div>\u6216\u662f\u7528\u66f4\u73fe\u4ee3\u7684\u5beb\u6cd5\uff08MariaDB 10.2+ \/ MySQL 8+ \u76f8\u5bb9\uff09\uff1a<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div dir=\"auto\">\n<div data-testid=\"code-block\">\n<div>\n<div>SQL<\/div>\n<div>\n<pre tabindex=\"0\"><code>CREATE USER IF NOT EXISTS 'roundcube'@'localhost' \r\nIDENTIFIED WITH mysql_native_password <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 MariaDB \/ MySQL \u4e2d\u6700\u5e38\u898b\u7684\u539f\u56e0\u5c31\u662f\uff1a\u9019\u500b\u5e33\u865f\u5176\u5be6\u5df2\u7d93\u5b58\u5728\uff0c\u53ea\u662f\u4f60\u7528 SELECT \u6216\u8089\u773c\u770b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,41],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/posts\/1777"}],"collection":[{"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1777"}],"version-history":[{"count":4,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/posts\/1777\/revisions"}],"predecessor-version":[{"id":1781,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=\/wp\/v2\/posts\/1777\/revisions\/1781"}],"wp:attachment":[{"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1777"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1777"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.dxQerp.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1777"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}