{"id":111,"date":"2019-07-10T10:37:22","date_gmt":"2019-07-10T02:37:22","guid":{"rendered":"http:\/\/www.cgh0610.cn\/?p=111"},"modified":"2019-07-10T10:37:22","modified_gmt":"2019-07-10T02:37:22","slug":"mysql%e4%b8%ad%e9%9a%8f%e6%9c%ba%e7%94%9f%e6%88%90%e5%9b%ba%e5%ae%9a%e9%95%bf%e5%ba%a6%e5%ad%97%e7%ac%a6%e4%b8%b2%e7%9a%84%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.cgh0610.cn\/?p=111","title":{"rendered":"MySQL\u4e2d\u968f\u673a\u751f\u6210\u56fa\u5b9a\u957f\u5ea6\u5b57\u7b26\u4e32\u7684\u65b9\u6cd5"},"content":{"rendered":"<p>\u5728MySQL\u4e2d\u6709\u65f6\u9700\u8981\u968f\u673a\u751f\u6210\u6307\u5b9a\u4f4d\u6570\u6570\u5b57\u6216\u5b57\u7b26\u4e32\uff0c\u968f\u673a\u751f\u4ea7\u6570\u5b57\u53ef\u76f4\u63a5\u4f7f\u7528rand()\u51fd\u6570\uff0c\u4f46\u662f\u8981\u968f\u673a\u751f\u6210\u5b57\u7b26\u4e32\u5c31\u6bd4\u8f83\u9ebb\u70e6\u3002<\/p>\n<p>\u8981\u968f\u673a\u751f\u6210\u5b57\u7b26\u4e32\u4ee3\u7801\u5982\u4e0b\uff1a<br \/>\n\u5728MySQL\u4e2d\u5b9a\u4e49\u4e00\u4e2a\u968f\u673a\u4e32\u7684\u65b9\u6cd5\uff0c\u7136\u540e\u5728MySQL\u8bed\u53e5\u4e2d\u8c03\u7528\u6b64\u65b9\u6cd5\u3002<\/p>\n<pre><code class=\"line-numbers\">CREATE DEFINER=`root`@`localhost` FUNCTION `rand_string`(n INT) RETURNS varchar(255) CHARSET latin1\nBEGIN\n    DECLARE chars_str varchar(100) DEFAULT 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';\n    DECLARE return_str varchar(255) DEFAULT '';\n    DECLARE i INT DEFAULT 0;\n    WHILE i &lt; n DO\n        SET return_str = concat(return_str,substring(chars_str , FLOOR(1 + RAND()*62 ),1));\n        SET i = i +1;\n    END WHILE;\n    RETURN return_str;\nEND;\n<\/code><\/pre>\n<p>\u5b9a\u4e49\u5b8c\u540e\uff0c\u5728MySQL\u8bed\u53e5\u4e2d\u8c03\u7528\u5373\u53ef<\/p>\n<pre><code class=\"line-numbers\">update member set salt=rand_string(6);\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728MySQL\u4e2d\u6709\u65f6\u9700\u8981\u968f\u673a\u751f\u6210\u6307\u5b9a\u4f4d\u6570\u6570\u5b57\u6216\u5b57\u7b26\u4e32\uff0c\u968f\u673a\u751f\u4ea7\u6570\u5b57\u53ef\u76f4\u63a5\u4f7f\u7528rand()\u51fd\u6570\uff0c\u4f46\u662f\u8981\u968f\u673a\u751f\u6210\u5b57\u7b26 &hellip; <a href=\"https:\/\/www.cgh0610.cn\/?p=111\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">MySQL\u4e2d\u968f\u673a\u751f\u6210\u56fa\u5b9a\u957f\u5ea6\u5b57\u7b26\u4e32\u7684\u65b9\u6cd5<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":[],"categories":[39,12],"tags":[48],"_links":{"self":[{"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/posts\/111"}],"collection":[{"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=111"}],"version-history":[{"count":1,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/posts\/111\/revisions"}],"predecessor-version":[{"id":112,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=\/wp\/v2\/posts\/111\/revisions\/112"}],"wp:attachment":[{"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cgh0610.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}