{"id":60,"date":"2022-01-14T11:18:54","date_gmt":"2022-01-14T03:18:54","guid":{"rendered":"https:\/\/www.zhangc.net\/?p=60"},"modified":"2022-01-14T11:19:20","modified_gmt":"2022-01-14T03:19:20","slug":"mysql-%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4","status":"publish","type":"post","link":"https:\/\/www.zhangc.net\/index.php\/2022\/01\/14\/mysql-%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4\/","title":{"rendered":"mysql \u5e38\u7528\u547d\u4ee4"},"content":{"rendered":"\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># \u6388\u6743\u7528\u6237== \u6307\u5b9aip\n\ngrant all privileges on *.* to repuser@localhost identified by 'repuser123';\ngrant all privileges on *.* to repuser@'127.0.0.1' identified by 'repuser123';\ngrant all privileges on *.* to repuser@'%' identified by 'repuser123';\n# \u66f4\u65b0\u6743\u9650\u8868\n\nflush privileges;\n# \u7136\u540e\u5c06mysql\u7aef\u53e3\u52a0\u5165\u9632\u706ba\u5899\u8bbe\u7f6e\uff0c\u5141\u8bb8\u5916\u90e8\u8bbf\u95ee\n\nmysql -A -urepuser -prepuser123 -P6033 -h*.*.*.* -N --default-character-set=utf8\nDELETE FROM test WHERE \u5217\u540d\u79f0 = \u503c\nCREATE DATABASE `le_shou` DEFAULT \nCREATE DATABASE `showdoc` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;\nACTER SET utf8 COLLATE utf8_general_ci;\nUPDATE \u8868\u540d\u79f0 SET \u5217\u540d\u79f0 = \u65b0\u503c WHERE \u5217\u540d\u79f0 = \u67d0\u503c\ninsert into  \u8868\u540d\u79f0 (\u5217\u540d\u79f0) values(\u67d0\u503c);\nTRUNCATE TABLE \u8868\u540d\u79f0;\nalter table \u8868\u540d add `\u5b57\u6bb5\u540d` \u5b57\u6bb5\u7c7b\u578b \u662f\u5426\u4e3a\u7a7a \u9ed8\u8ba4\u503c \u6ce8\u91ca after \u5b57\u6bb5\u540d(\u6dfb\u52a0\u5728\u67d0\u4e2a\u5b57\u6bb5\u4e0b) ;\nalter table \u8868\u540d change \u539f\u5b57\u6bb5\u540d \u5b57\u6bb5\u540d \u5b57\u6bb5\u7c7b\u578b \u662f\u5426\u4e3a\u7a7a \u9ed8\u8ba4\u503c \u6ce8\u91ca\u3002\nalter table \u8868\u540d drop column \u5b57\u6bb5\u540d;\n# mysql\u53bb\u6389\u5b57\u6bb5\u5b57\u7b26\u4e2d\u95f4\u7a7a\u683c\n\nupdate `news` set `content`=replace(`content`,' ','');\/\/\u6e05\u9664news\u8868\u4e2dcontent\u5b57\u6bb5\u4e2d\u7684\u7a7a\u683c \nERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111) \u8fd9\u4e2a\u95ee\u9898\u662f\u56e0\u4e3a\u5728my.cnf\u91cc\u8bbe\u7f6e\u4e86bind-address\u5bfc\u81f4\u7684\uff0c\u6ce8\u91ca\u6389\u6216\u8005\u5c06-h\u8bbe\u7f6e\u4e3abind-address\u8bbe\u7f6e\u7684\u5730\u5740\u5373\u53ef\n\n# mysql\u5bfc\u51fa\u6307\u5b9a\u5b57\u6bb5\u6570\u636e\n\nmysql -h192.168.0.104 -urepuser -prepuser123 -P6033 le_shou -e \"select ci_addtime,ci_mobile,ci_company,ci_address from DT_CompanyInfo where ci_addtime>='2015-05-01 00:00:00' into outfile  '\/tmp\/dt_companyinfo.txt'\"\n# \u5bfc\u51fa\u6574\u4e2a\u5e93\u7684\u8868\u7ed3\u6784\u5982\u4e0b\uff1a\n\nmysqldump -uroot -p -d databasename > createtab.sql\n# \u5982\u679c\u53ea\u60f3\u5bfc\u51fa \u8868 test1\uff0ctest2\uff0ctest3 \u7684 \u8868\u7ed3\u6784 \u548c \u6570\u636e\u5462\uff1f \u8be5\u5982\u4f55\u5bfc\u51fa\uff1f\n\nmysqldump -uroot -p -d databasename test1 test2 test3 > createtab.sql\n\n#  \u4e0a\u9762\u7684\u662f\u5bfc\u51fa\u6307\u5b9a\u8868\u7ed3\u6784\uff0c\u4e0b\u9762\u8fd9\u4e2a\u53ef\u4ee5\u5bfc\u51fa\u6307\u5b9a\u8868\u7ed3\u6784\u548c\u6570\u636e\nmysqldump -uroot -p --tables databasename > createtab.sql\nmysqldump -uroot -p -d databasename test1 test2 test3 > createtab.sql\nmysql\u590d\u5236\u5e93\n\nmysqldump olddb -u root -ppassword --add-drop-table | mysql newdb -h mysqlhost -u root -ppassword\n# mysql \u6279\u91cf\u4fee\u6539\u8bb0\u5f55\n\n# mark \u4ee3\u8868\u5b57\u6bb5\u540d\n# \u5728mark\u5b57\u6bb5\u540e\u8ffd\u52a0_INVAILD\nUPDATE cmf_ios_certificate SET mark =  CONCAT(mark,\"_INVAILD\")\n#  \u5220\u9664mark\u5b57\u6bb5\u4e2d\u7684cd\nUPDATE cmf_ios_certificate SET mark =  replace(mark,'cd','')<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-60","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/posts\/60","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/comments?post=60"}],"version-history":[{"count":1,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":61,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/posts\/60\/revisions\/61"}],"wp:attachment":[{"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangc.net\/index.php\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}