{"id":143,"date":"2023-03-20T09:20:44","date_gmt":"2023-03-20T01:20:44","guid":{"rendered":"https:\/\/www.aqrboyblog.top\/?p=143"},"modified":"2025-05-15T17:10:56","modified_gmt":"2025-05-15T09:10:56","slug":"mysql-%e7%bb%88%e7%ab%af","status":"publish","type":"post","link":"https:\/\/www.aqrboyblog.top\/?p=143","title":{"rendered":"mysql\u547d\u4ee4"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>\u5e38\u7528\u4ee3\u7801<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u8bbe\u7f6e\u81ea\u589e\u5b57\u6bb5\nalter table \u6570\u636e\u8868\u540d modify \u5b57\u6bb5\u540d int auto_increment;\nalter table demo modify id int auto_increment;\n\/\/ \u4fee\u6539\u81ea\u589e \u8d77\u59cb\u503c\nalter table \u6570\u636e\u8868\u540d auto_increment = 1001;\nalter table demo auto_increment = 1000;\n\/\/\u5bfc\u51fa\u6570\u636e\u5e93\nmysqldump -h localhost -P 3306 -u root -p  table_name > table_name_bak.sql\n\nmysql -u root  -p  table_name &lt; table_name_bak.sql<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">linux<strong>\u7ec8\u7aef<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/\u767b\u5f55mysql(\u6709\u5bc6\u7801\u8bf7\u8f93\u5165\u5bc6\u7801)\nmysql -u root -p\n\/\/\u6253\u5f00\u6570\u636e\u5e93\nshow database;\n\/\/\u8bbe\u7f6e\u5bc6\u7801\nset password = password('123456');\n\/\/\u9000\u51fa\nexit;\n\/\/\u4f7f\u7528 mysql \u6570\u636e\u5e93\nuse mysql;\n\/\/ \u67e5\u8be2MySQL\u8d26\u6237\nselect user,host from user;\n\/\/\u66f4\u6539\u8bbf\u95ee\u9650\u5236 \nupdate user set host=\u2019%\u2019where user=\u2019\u7528\u6237\u540d\u2019@'\u672c\u5730\u8d26\u6237';\n\/\/\u793a\u4f8b:\nupdate user set host=\u2019%\u2019where user=\u2019root\u2019@'localhost';\n\/\/\u65b0\u589e\u8fdc\u7a0b\u8bbf\u95ee\u8d26\u53f7 \ngrant all privileges on \u6570\u636e\u5e93.\u6570\u636e\u8868 to \u7528\u6237\u540d @\"%\" identified by \"\u5bc6\u7801\";\n\/\/\u793a\u4f8b:\ngrant all privileges on *.* to remoteUser @\"%\" identified by \"123456\";\n\/\/\u66f4\u65b0\u914d\u7f6e\nflush privileges;\n\/\/\u521b\u5efa\u7528\u6237\nCREATE USER '\u8fdc\u7a0b\u7528\u6237'@'%' IDENTIFIED BY '\u5bc6\u7801';\n\/\/\u793a\u4f8b:\nCREATE USER 'remoteUser'@'%' IDENTIFIED BY '123456';\n\u4fee\u6539\u5bc6\u7801\nALTER  user '\u7528\u6237\u540d'@'\u672c\u5730\u8d26\u6237'IDENTIFIED BY '\u5bc6\u7801';\n\/\/\u793a\u4f8b:\nALTER USER 'root'@'localhost' IDENTIFIED BY '123456';\n\/\/ \u7528\u6237\u5206\u914d\u6743\u9650\nGRANT SELECT, INSERT, UPDATE, REFERENCES, DELETE, CREATE, DROP, ALTER, INDEX, TRIGGER, CREATE VIEW, SHOW VIEW, EXECUTE, ALTER ROUTINE, CREATE ROUTINE, CREATE TEMPORARY TABLES, LOCK TABLES, EVENT ON `\u6570\u636e\u5e93\u540d\u79f0`.* TO '\u8fdc\u7a0b\u7528\u6237'@'%';\n\/\/\u793a\u4f8b:\nGRANT SELECT, INSERT, UPDATE, REFERENCES, DELETE, CREATE, DROP, ALTER, INDEX, TRIGGER, CREATE VIEW, SHOW VIEW, EXECUTE, ALTER ROUTINE, CREATE ROUTINE, CREATE TEMPORARY TABLES, LOCK TABLES, EVENT ON `mysql`.* TO 'remoteUser'@'%';\n\/\/ \u5206\u914d\u6307\u5b9a\u8868\nGRANT GRANT OPTION ON `\u6570\u636e\u5e93\u540d\u79f0`.* TO '\u8fdc\u7a0b\u7528\u6237'@'%';\nGRANT GRANT OPTION ON `mysql`.* TO 'remoteUser'@'%';\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p class=\"text-justify\">\u5e38\u7528\u4ee3\u7801 linux\u7ec8\u7aef<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-143","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts\/143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=143"}],"version-history":[{"count":16,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts\/143\/revisions"}],"predecessor-version":[{"id":473,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=\/wp\/v2\/posts\/143\/revisions\/473"}],"wp:attachment":[{"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aqrboyblog.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}