{"id":501,"date":"2023-06-05T12:37:28","date_gmt":"2023-06-05T04:37:28","guid":{"rendered":"https:\/\/por.tw\/php\/?p=478"},"modified":"2020-11-01T02:01:18","modified_gmt":"2020-10-31T18:01:18","slug":"%e7%b6%b2%e7%ab%99%e8%b3%87%e6%96%99%e5%ba%ab%e6%98%af%e9%81%b8%e6%93%87-mysql-%e5%a5%bd%e5%91%a2%ef%bc%9f%e9%82%84%e6%98%af%e9%81%b8%e6%93%87-mariadb-%e6%af%94%e8%bc%83%e5%a5%bd%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/por.tw\/php\/%e7%b6%b2%e7%ab%99%e8%b3%87%e6%96%99%e5%ba%ab%e6%98%af%e9%81%b8%e6%93%87-mysql-%e5%a5%bd%e5%91%a2%ef%bc%9f%e9%82%84%e6%98%af%e9%81%b8%e6%93%87-mariadb-%e6%af%94%e8%bc%83%e5%a5%bd%ef%bc%9f\/","title":{"rendered":"\u7db2\u7ad9\u8cc7\u6599\u5eab\u662f\u9078\u64c7 MySQL \u597d\u5462\uff1f\u9084\u662f\u9078\u64c7 MariaDB \u6bd4\u8f03\u597d\uff1f"},"content":{"rendered":"<p><span style=\"font-size: 20px; color: #008000;\"><strong>MySQL \u548c MariaDB \u90fd\u53ef\u4ee5\u8207PHP\u7a0b\u5f0f\u8a9e\u8a00\u5bc6\u5207\u89e3\u548c\u4f7f\u7528\uff01<\/strong><\/span><br \/>\n<span style=\"font-size: 20px; color: #ffff00; background-color: #ff0000;\"><strong>\u7db2\u7ad9\u4f7f\u7528\u7684\u8cc7\u6599\u5eab\uff0c\u662f\u9078\u64c7 MySQL \u597d\u5462\uff1f\u9084\u662f\u9078\u64c7 MariaDB \u6bd4\u8f03\u597d\uff1f<\/strong><\/span><br \/>\n<span style=\"font-size: 20px; color: #0000ff;\"><strong>\u90a3\u6211\u5011\u5148\u4f86\u770b\uff1a\u8ab0\u5728\u4f7f\u7528 MySQL \u548c MariaDB\uff1f<\/strong><\/span><br \/>\n<span style=\"color: #800000;\"><strong><span style=\"font-size: 16px;\">MySQL \u548c MariaDB \u90fd\u767c\u5e03\u4e86\u5404\u81ea\u7684\u7528\u6236\u540d\u55ae\uff1a<\/span><\/strong><\/span><br \/>\n<span style=\"background-color: #00ffff;\"><strong><span style=\"font-size: 16px; background-color: #00ffff;\">\u4f7f\u7528 MySQL \u7684\u6709 Facebook\u3001Github\u3001YouTube\u3001Twitter\u3001PayPal\u3001\u8afe\u57fa\u4e9e\u3001Spotify\u3001Netflix \u7b49\u3002<\/span><\/strong><\/span><br \/>\n<span style=\"background-color: #ff99cc;\"><strong><span style=\"font-size: 16px; background-color: #ff99cc;\">\u4f7f\u7528 MariaDB \u7684\u6709 Redhat\u3001DBS\u3001Suse\u3001Ubuntu\u30011\uff061\u3001Ingenico \u7b49\u3002<\/span><\/strong><\/span><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/visdacom.com\/php\/wp-content\/uploads\/2019\/12\/Untitled-650x458.png\" alt=\"\" class=\"alignnone size-medium wp-image-479\" width=\"650\" height=\"458\" \/><br \/>\n<span style=\"font-size: 24px; background-color: #ff0000; color: #ffffff;\"><strong>MySQL \u8207 MariaDB \u529f\u80fd\u6bd4\u8f03\uff1a<\/strong><\/span><br \/>\n<strong><span style=\"font-size: 16px;\">\u6709\u4e00\u4e9b\u4ee4\u4eba\u8208\u596e\u7684\u65b0\u529f\u80fd\uff08\u5982\u8996\u7a97\u51fd\u6578\u3001\u89d2\u8272\u63a7\u5236\u6216\u516c\u5171\u8868\u8868\u9054\u5f0f\uff08CTE\uff09\uff09\u53ef\u80fd\u503c\u5f97\u4e00\u63d0\uff0c\u4f46\u672c\u6587\u53ea\u662f\u70ba\u4e86\u6bd4\u8f03\u5169\u500b\u8cc7\u6599\u5eab\uff0c\u6240\u4ee5\u6211\u5011\u5728\u9019\u88e1\u53ea\u8a0e\u8ad6\u5176\u4e2d\u4e00\u65b9\u5c08\u9580\u63d0\u4f9b\u7684\u529f\u80fd\uff0c\u4ee5\u4fbf\u66f4\u597d\u5730\u8aaa\u660e\u8b80\u8005\u9078\u53d6\u5408\u9069\u81ea\u5df1\u7684\u8cc7\u6599\u5eab\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u8b93\u6211\u5011\u4f86\u770b\u4e00\u4e0b\u53ea\u6709\u5176\u4e2d\u4e00\u500b\u8cc7\u6599\u5eab\u5c08\u9580\u63d0\u4f9b\u7684\u529f\u80fd\uff1a<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">1. JSON \u8cc7\u6599\u985e\u578b\u2014\u2014\u5f9e 5.7 \u7248\u672c\u958b\u59cb\uff0cMySQL \u652f\u63f4\u7531 RFC 7159 \u5b9a\u7fa9\u7684\u539f\u751f JSON \u8cc7\u6599\u985e\u578b\uff0c\u53ef\u4ee5\u9ad8\u6548\u5730\u8a2a\u554f JSON \u6587\u4ef6\u4e2d\u7684\u8cc7\u6599\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">MariaDB \u6c92\u6709\u63d0\u4f9b\u9019\u4e00\u589e\u5f37\u529f\u80fd\uff0c\u8a8d\u70ba JSON \u8cc7\u6599\u985e\u578b\u4e0d\u662f SQL \u6a19\u6e96\u7684\u4e00\u90e8\u5206\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u4f46\u70ba\u4e86\u652f\u63f4\u5f9e MySQL \u8907\u88fd\u8cc7\u6599\uff0cMariaDB \u70ba JSON \u5b9a\u7fa9\u4e86\u4e00\u500b\u5225\u540d\uff0c\u5be6\u969b\u4e0a\u5c31\u662f\u4e00\u500b LONGTEXT \u5217\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">MariaDB \u8072\u7a31\u5169\u8005\u4e4b\u9593\u6c92\u6709\u986f\u8457\u7684\u6548\u80fd\u5dee\u7570\uff0c\u4f46\u4ed6\u5011\u4e26\u6c92\u6709\u63d0\u4f9b\u57fa\u6e96\u6e2c\u8a66\u8cc7\u6599\u4f86\u652f\u63f4\u9019\u500b\u8aaa\u6cd5\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0cMySQL \u548c MariaDB \u90fd\u63d0\u4f9b\u4e86\u4e00\u4e9b JSON \u95dc\u806f\u51fd\u6578\uff0c\u7528\u65bc\u66f4\u65b9\u4fbf\u5730\u8a2a\u554f\u3001\u89e3\u6790\u548c\u6aa2\u7d22 JSON \u8cc7\u6599\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">2. \u9810\u8a2d\u8eab\u4efd\u8a8d\u8b49\u2014\u2014\u5728 MySQL 8.0 \u4e2d\uff0c\u9810\u8a2d\u7684\u8eab\u4efd\u8a8d\u8b49\u5916\u639b\u7a0b\u5f0f\u662f caching_sha2_password\uff0c\u800c\u4e0d\u662f mysql_native_password\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u9019\u4e00\u589e\u5f37\u901a\u904e\u4f7f\u7528 SHA-256 \u7b97\u6cd5\u63d0\u9ad8\u4e86\u5b89\u5168\u6027\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">3. MySQL Shell\u2014\u2014MySQL Shell \u662f MySQL \u7684\u9032\u968e\u6307\u4ee4\u884c\u7528\u6236\u7aef\u548c\u4ee3\u78bc\u7de8\u8f2f\u5668\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u9664\u4e86 SQL \u4e4b\u5916\uff0cMySQL Shell \u9084\u63d0\u4f9b\u4e86 JavaScript \u548c Python \u8173\u672c\u529f\u80fd\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u4e0d\u904e\u4f7f\u7528\u8005\u4e0d\u80fd\u4f7f\u7528 mysqlsh \u8a2a\u554f MariaDB \u4f3a\u670d\u5668\uff0c\u56e0\u70ba MariaDB \u4e0d\u652f\u63f4 MySQL X \u5354\u5b9a\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">4. \u52a0\u5bc6\u2014\u2014MySQL \u5c0d\u91cd\u505a \/ \u5fa9\u539f\u65e5\u8a8c\u9032\u884c\u4e86\u52a0\u5bc6\uff08\u53ef\u914d\uff09\uff0c\u4f46\u4e0d\u52a0\u5bc6\u81e8\u6642\u8868\u7a7a\u9593\u6216\u4e8c\u9032\u4f4d\u65e5\u8a8c\u3002\u76f8\u53cd\uff0cMariaDB \u652f\u63f4\u4e8c\u9032\u4f4d\u65e5\u8a8c\u548c\u81e8\u6642\u8868\u52a0\u5bc6\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">5. \u5bc6\u9470\u7ba1\u7406\u2014\u2014MariaDB \u63d0\u4f9b\u958b\u7bb1\u5373\u7528\u7684 AWS \u5bc6\u9470\u7ba1\u7406\u5916\u639b\u7a0b\u5f0f\u3002MySQL \u4e5f\u63d0\u4f9b\u4e86\u4e00\u4e9b\u7528\u65bc\u5bc6\u9470\u7ba1\u7406\u7684\u5916\u639b\u7a0b\u5f0f\uff0c\u4f46\u5b83\u5011\u50c5\u5728\u4f01\u696d\u7248\u4e2d\u53ef\u7528\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">6. sys \u6a21\u5f0f\u2014\u2014MySQL 8.0 \u63d0\u4f9b\u4e86 sys \u6a21\u5f0f\uff0c\u9019\u662f\u4e00\u7d44\u5c0d\u8c61\uff0c\u53ef\u8aaa\u660e\u8cc7\u6599\u5eab\u7ba1\u7406\u54e1\u548c\u8edf\u9ad4\u5c08\u6848\u5e2b\u66f4\u597d\u5730\u7406\u89e3\u901a\u904e Performance \u6a21\u5f0f\u6536\u96c6\u7684\u8cc7\u6599\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">sys \u6a21\u5f0f\u5c0d\u8c61\u53ef\u7528\u65bc\u6539\u5584\u548c\u8a3a\u65b7\uff0c\u4e0d\u904e MariaDB \u6c92\u6709\u63d0\u4f9b\u9019\u500b\u589e\u5f37\u529f\u80fd\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">7. validate_password \u5916\u639b\u7a0b\u5f0f\u2014\u2014validate_password \u5916\u639b\u7a0b\u5f0f\u4e3b\u8981\u7528\u65bc\u6e2c\u8a66\u5bc6\u78bc\u4e26\u63d0\u9ad8\u5b89\u5168\u6027\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">MySQL \u9810\u8a2d\u555f\u7528\u4e86\u9019\u500b\u5916\u639b\u7a0b\u5f0f\uff0c\u800c MariaDB \u5247\u4e0d\u555f\u7528\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">8. \u8d85\u7d1a\u552f\u8b80\u2014\u2014 MySQL \u901a\u904e\u63d0\u4f9b\u8d85\u7d1a\u552f\u8b80\uff08super read-only\uff09\u6a21\u5f0f\u4f86\u589e\u5f37 read_only \u529f\u80fd\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u5982\u679c\u555f\u7528\u4e86 read_only\uff0c\u4f3a\u670d\u5668\u53ea\u5bb9\u8a31\u5177\u6709 SUPER \u6b0a\u9650\u7684\u4f7f\u7528\u8005\u57f7\u884c\u7528\u6236\u7aef\u66f4\u65b0\u3002\u5982\u679c\u540c\u6642\u555f\u7528\u4e86 super_read_only\uff0c\u90a3\u9ebc\u4f3a\u670d\u5668\u5c07\u7981\u6b62\u5177\u6709 SUPER \u6b0a\u9650\u7684\u4f7f\u7528\u8005\u57f7\u884c\u7528\u6236\u7aef\u66f4\u65b0\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">9. \u4e0d\u53ef\u898b\u5217\u2014\u2014\u9019\u500b\u529f\u80fd\u5728 MariaDB \u4e0a\u53ef\u7528\uff0cMySQL \u4e0d\u652f\u63f4\u8a72\u529f\u80fd\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u9019\u500b\u529f\u80fd\u5bb9\u8a31\u5efa\u7acb\u672a\u5728 SELECT * \u8a9e\u53e5\u4e2d\u51fa\u73fe\u7684\u5217\uff0c\u800c\u5728\u9032\u884c\u63d2\u5165\u6642\uff0c\u5982\u679c\u5b83\u5011\u7684\u540d\u5b57\u6c92\u6709\u51fa\u73fe\u5728 INSERT \u8a9e\u53e5\u4e2d\uff0c\u5c31\u4e0d\u9700\u8981\u70ba\u9019\u4e9b\u5217\u63d0\u4f9b\u503c\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">10. \u57f7\u884c\u7dd2\u6c60\u2014\u2014MariaDB \u652f\u63f4\u9023\u7dda\u57f7\u884c\u7dd2\u6c60\uff0c\u9019\u5c0d\u65bc\u77ed\u67e5\u8a62\u548c CPU \u5bc6\u96c6\u578b\u7684\u5de5\u4f5c\u8ca0\u8f09\uff08OLTP\uff09\u4f86\u8aaa\u975e\u5e38\u6709\u7528\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u5728 MySQL \u7684\u793e\u5340\u7248\u672c\u4e2d\uff0c\u57f7\u884c\u7dd2\u6578\u662f\u56fa\u5b9a\u7684\uff0c\u56e0\u800c\u9650\u5236\u4e86\u9019\u7a2e\u5f48\u6027\u3002MySQL \u8a08\u5283\u5728\u4f01\u696d\u7248\u4e2d\u589e\u52a0\u57f7\u884c\u7dd2\u6c60\u529f\u80fd\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u6548\u80fd<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u8fd1\u5e74\u4f86\uff0c\u51fa\u73fe\u4e86\u5f88\u591a\u95dc\u65bc MySQL \u548c MariaDB \u5f15\u64ce\u6548\u80fd\u7684\u57fa\u6e96\u6e2c\u8a66\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u6211\u5011\u4e0d\u8a8d\u70ba\u300cMySQL \u6216 MariaDB \u54ea\u500b\u66f4\u5feb\u300d\u9019\u500b\u554f\u984c\u6703\u6709\u4e00\u500b\u6700\u7d42\u7684\u7b54\u6848\uff0c\u5b83\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u53d6\u6c7a\u65bc\u5177\u9ad4\u7684\u4f7f\u7528\u5834\u666f\u3001\u67e5\u8a62\u3001\u4f7f\u7528\u8005\u548c\u9023\u7dda\u6578\u91cf\u7b49\u56e0\u7d20\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u4e0d\u904e\uff0c\u5982\u679c\u4f60\u78ba\u5be6\u60f3\u77e5\u9053\uff0c\u4e0b\u9762\u5217\u51fa\u4e86\u6211\u5011\u767c\u73fe\u7684\u4e00\u4e9b\u6700\u65b0\u7684\u57fa\u6e96\u6e2c\u8a66\u7d50\u679c\u3002<\/span><\/strong><br \/>\n<strong><span style=\"font-size: 16px;\">\u8acb\u6ce8\u610f\uff0c\u9019\u4e9b\u6e2c\u8a66\u90fd\u662f\u5728\u4e00\u7d44\u7279\u5b9a\u7684\u8cc7\u6599\u5eab + \u5f15\u64ce\uff08\u4f8b\u5982 MySQL+InnoDB\uff09\u7d44\u5408\u4e0a\u9032\u884c\u7684\uff0c\u56e0\u6b64\u5f97\u51fa\u7684\u7d50\u8ad6\u53ea\u8207\u7279\u5b9a\u7684\u7d44\u5408\u6709\u95dc\u3002<\/span><\/strong><br \/>\n<span style=\"background-color: #ff0000; color: #ffffff;\"><strong><span style=\"font-size: 16px; background-color: #ff0000;\">\u4e4b\u524d\uff0c\u56e0\u70ba\u6709\u50b3\u51faMySQL\u5b89\u5168\u554f\u984c\uff1a<span style=\"color: #ffff00;\">\u5b89\u5168\u9867\u554f\u63ed\u9732MySQL\u542b\u6709\u53ef\u7aca\u53d6\u7528\u6236\u6a94\u6848\u7684\u8a2d\u8a08\u6f0f\u6d1e<\/span><\/span><\/strong><\/span><br \/>\n<span style=\"font-size: 20px;\"><strong>\u6240\u4ee5\uff0c\u6709\u4e00\u4e9b\u7db2\u7ad9\u8207\u7a0b\u5f0f\u8a2d\u8a08\u5c31\u6539\u4f7f\u7528\uff1aMariaDB \u8cc7\u6599\u5eab<\/strong><\/span><br \/>\n<span style=\"font-size: 20px;\"><strong>\u9019\u9ebc\u4e00\u6539\uff0c\u6709\u4e9b\u4eba\u5c31\u56de\u4e0d\u53bb\u4e86\uff08\u96d6\u7136 MySQL \u4e00\u76f4\u6709\u5728\u9032\u6b65\uff09<\/strong><\/span><br \/>\n<span style=\"font-size: 20px; color: #ff0000;\"><strong>\u4f7f\u7528\u7fd2\u6163\u4e86\uff0c\u90a3\u5e79\u9ebb\u9700\u8981\u6539\u4f86\u6539\u53bb\uff1f\u81ea\u627e\u9ebb\u7169\uff01<\/strong><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MySQL \u548c MariaDB \u90fd\u53ef\u4ee5\u8207PHP\u7a0b\u5f0f\u8a9e\u8a00\u5bc6\u5207\u89e3\u548c\u4f7f\u7528\uff01 \u7db2\u7ad9\u4f7f\u7528\u7684\u8cc7\u6599\u5eab\uff0c\u662f\u9078\u64c7 MySQL \u597d [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":481,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-501","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-mysql-"],"_links":{"self":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts\/501"}],"collection":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/comments?post=501"}],"version-history":[{"count":0,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/posts\/501\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/media\/481"}],"wp:attachment":[{"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/media?parent=501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/categories?post=501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/por.tw\/php\/wp-json\/wp\/v2\/tags?post=501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}