{"id":291371,"date":"2024-05-03T23:09:48","date_gmt":"2024-05-03T15:09:48","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=291371"},"modified":"2024-08-18T15:53:05","modified_gmt":"2024-08-18T07:53:05","slug":"learing-linux-18","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/learing-linux-18.html","title":{"rendered":"\u7b2c18\u7ae0 \u4f7f\u7528MariaDB\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf"},"content":{"rendered":"

\u7ae0\u8282\u7b80\u8ff0\uff1a<\/span><\/strong><\/p>\n

\u81ea\u4eceMySQL\u6570\u636e\u5e93\u9879\u76ee\u88abOracle\u516c\u53f8\u6536\u8d2d\u540e\uff0c\u5176\u4ece\u5f00\u6e90\u8f6f\u4ef6\u9010\u6e10\u8f6c\u53d8\u4e3a\u201c\u95ed\u6e90\u201d\u8f6f\u4ef6\uff0c\u8fd9\u4e00\u53d8\u5316\u4fc3\u4f7f\u4f17\u591a\u4f01\u4e1a\u548c\u5382\u5546\u7eb7\u7eb7\u8f6c\u5411MariaDB\u8fd9\u4e00\u65b0\u5174\u7684\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u3002MariaDB\u51ed\u501f\u5176\u5f00\u6e90\u7279\u6027\u548c\u7a33\u5b9a\u6027\uff0c\u8fc5\u901f\u5360\u636e\u4e86\u5e02\u573a\uff0c\u6210\u4e3aMySQL\u7684\u70ed\u95e8\u66ff\u4ee3\u54c1\u3002<\/p>\n

\u672c\u7ae0\u5c06\u9996\u5148\u4ecb\u7ecd\u6570\u636e\u5e93\u53ca\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u7684\u57fa\u672c\u7406\u8bba\u77e5\u8bc6\uff0c\u968f\u540e\u6df1\u5165\u8bb2\u89e3MariaDB\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u7684\u7279\u6027\u548c\u529f\u80fd\u3002\u901a\u8fc7\u52a8\u624b\u5b9e\u9a8c\u7684\u65b9\u5f0f\uff0c\u8bfb\u8005\u5c06\u5b66\u4e60\u5982\u4f55\u5728MariaDB\u4e2d\u8fdb\u884c\u5e38\u89c4\u64cd\u4f5c\uff0c\u5305\u62ec\u7528\u6237\u521b\u5efa\u4e0e\u7ba1\u7406\u3001\u6743\u9650\u6388\u6743\u3001\u65b0\u5efa\u6570\u636e\u5e93\u53ca\u6570\u636e\u5e93\u8868\u3001\u4ee5\u53ca\u6267\u884c\u65b0\u5efa\u3001\u5220\u9664\u3001\u4fee\u6539\u548c\u67e5\u8be2\u7b49\u6570\u636e\u5e93\u64cd\u4f5c\u3002\u6b64\u5916\uff0c\u672c\u7ae0\u8fd8\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u6570\u636e\u5e93\u7684\u5907\u4efd\u4e0e\u6062\u590d\u65b9\u6cd5\uff0c\u786e\u4fdd\u8bfb\u8005\u4e0d\u4ec5\u80fd\u591f\u719f\u7ec3\u638c\u63e1\u201c\u589e\u5220\u6539\u67e5\u201d\u64cd\u4f5c\uff0c\u8fd8\u80fd\u80dc\u4efb\u751f\u4ea7\u73af\u5883\u4e2d\u7684\u6570\u636e\u5e93\u7ba1\u7406\u4e0e\u7ef4\u62a4\u5de5\u4f5c\u3002<\/p>\n

18.1 \u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf<\/strong><\/span><\/h5>\n

\u6570\u636e\u5e93\u662f\u6307\u6309\u7167\u7279\u5b9a\u7ed3\u6784\u5b58\u50a8\u6570\u636e\u7684\u4ed3\u5e93\u3002\u5728\u5927\u6570\u636e\u6280\u672f\u8fc5\u731b\u53d1\u5c55\u7684\u4eca\u5929\uff0c\u4e92\u8054\u7f51\u4e0a\u6bcf\u5929\u90fd\u4f1a\u4ea7\u751f\u6d77\u91cf\u4fe1\u606f\uff0c\u6570\u636e\u5e93\u6280\u672f\u4e5f\u4ece\u6700\u521d\u7684\u7b80\u5355\u8868\u683c\u6570\u636e\u5b58\u50a8\u6a21\u5f0f\uff0c\u53d1\u5c55\u5230\u5982\u4eca\u7684\u5927\u578b\u5206\u5e03\u5f0f\u5b58\u50a8\u6a21\u5f0f\u3002\u6709\u6548\u7ba1\u7406\u548c\u5229\u7528\u8fd9\u4e9b\u6570\u636e\uff0c\u6316\u6398\u5176\u4ef7\u503c\uff0c\u662f\u79d1\u5b66\u7814\u7a76\u548c\u51b3\u7b56\u7ba1\u7406\u7684\u91cd\u8981\u524d\u63d0\u3002\u800c\u6570\u636e\u5e93\u6280\u672f\u5219\u662f\u5404\u7c7b\u4fe1\u606f\u7ba1\u7406\u7cfb\u7edf\u3001\u529e\u516c\u81ea\u52a8\u5316\u7cfb\u7edf\u4ee5\u53ca\u51b3\u7b56\u652f\u6301\u7cfb\u7edf\u7684\u6838\u5fc3\u7ec4\u6210\u90e8\u5206\uff0c\u662f\u6570\u636e\u7ba1\u7406\u4e0e\u5206\u6790\u7684\u5173\u952e\u5de5\u5177\u3002<\/p>\n

\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u662f\u4e00\u79cd\u80fd\u591f\u5bf9\u6570\u636e\u5e93\u4e2d\u5b58\u653e\u7684\u6570\u636e\u8fdb\u884c\u5efa\u7acb\u3001\u4fee\u6539\u3001\u5220\u9664\u3001\u67e5\u627e\u3001\u7ef4\u62a4\u7b49\u64cd\u4f5c\u7684\u8f6f\u4ef6\u7a0b\u5e8f\u3002\u5b83\u901a\u8fc7\u628a\u8ba1\u7b97\u673a\u4e2d\u5177\u4f53\u7684\u7269\u7406\u6570\u636e\u8f6c\u6362\u6210\u9002\u5408\u7528\u6237\u7406\u89e3\u7684\u62bd\u8c61\u903b\u8f91\u6570\u636e\uff0c\u6709\u6548\u5730\u964d\u4f4e\u6570\u636e\u5e93\u7ba1\u7406\u7684\u6280\u672f\u95e8\u69db\uff0c\u56e0\u6b64\u5373\u4fbf\u662f\u4ece\u4e8bLinux\u8fd0\u7ef4\u5de5\u4f5c\u7684\u5de5\u7a0b\u5e08\u4e5f\u53ef\u4ee5\u5bf9\u6570\u636e\u5e93\u8fdb\u884c\u57fa\u672c\u7684\u7ba1\u7406\u64cd\u4f5c\u3002\u4f46\u662f\uff0c\u5218\u9044\u8001\u5e08\u6709\u5fc5\u8981\u63d0\u9192\u5404\u4f4d\u8bfb\u8005\uff0c\u672c\u4e66\u7684\u6280\u672f\u4e3b\u7ebf\u4f9d\u7136\u662fLinux\u7cfb\u7edf\u7684\u8fd0\u7ef4\uff0c\u800c\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u53ea\u4e0d\u8fc7\u662f\u5728\u6b64\u4e3b\u7ebf\u4e0a\u7684\u4e00\u4e2a\u5185\u5bb9\u4e0d\u65ad\u6a2a\u5411\u6269\u5c55\u3001\u7eb5\u5411\u52a0\u6df1\u7684\u5206\u652f\uff0c\u4e0d\u80fd\u6307\u671b\u5728\u4e00\u4e24\u5929\u4e4b\u5185\u5c31\u80fd\u7cbe\u901a\u6570\u636e\u5e93\u7ba1\u7406\u6280\u672f\u3002\u5982\u679c\u6709\u8bfb\u8005\u5728\u5b66\u5b8c\u672c\u7ae0\u5185\u5bb9\u4e4b\u540e\u5bf9\u6570\u636e\u5e93\u7ba1\u7406\u6280\u672f\u4ea7\u751f\u4e86\u6d53\u539a\u5174\u8da3\uff0c\u5e76\u5e0c\u671b\u8c0b\u5f97\u4e00\u4efd\u76f8\u5173\u7684\u5de5\u4f5c\uff0c\u90a3\u4e48\u5c31\u9700\u8981\u989d\u5916\u4e3a\u81ea\u5df1\u5236\u5b9a\u8be6\u7ec6\u7684\u8ba1\u5212\u8fdb\u884c\u6df1\u5165\u5b66\u4e60\u4e86\u3002<\/p>\n

\u65e2\u7136\u662f\u8bb2\u89e3\u6570\u636e\u5e93\u7ba1\u7406\u6280\u672f\uff0c\u5c31\u5fc5\u7136\u7ed5\u4e0d\u5f00MySQL\u3002MySQL\u4f5c\u4e3a\u5168\u7403\u5e02\u573a\u5360\u6709\u7387\u6781\u9ad8\u7684\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u4ee5\u5176\u6210\u719f\u7684\u6280\u672f\u3001\u7b80\u5355\u7684\u914d\u7f6e\u4ee5\u53ca\u826f\u597d\u7684\u53ef\u6269\u5c55\u6027\u8457\u79f0\u3002\u7136\u800c\uff0c\u7531\u4e8eOracle\u516c\u53f8\u57282009\u5e74\u6536\u8d2d\u4e86MySQL\u7684\u6bcd\u516c\u53f8Sun\uff0c\u56e0\u6b64MySQL\u6570\u636e\u5e93\u9879\u76ee\u4e5f\u968f\u4e4b\u7eb3\u5165Oracle\u9ebe\u4e0b\uff0c\u9010\u6b65\u6f14\u53d8\u4e3a\u4fdd\u6301\u7740\u5f00\u6e90\u8f6f\u4ef6\u7684\u8eab\u4efd\uff0c\u4f46\u53c8\u7533\u8bf7\u4e86\u591a\u9879\u5546\u4e1a\u4e13\u5229\u7684\u8f6f\u4ef6\u7cfb\u7edf\u3002\u5f00\u6e90\u8f6f\u4ef6\u662f\u5168\u7403\u9ed1\u5ba2\u3001\u6781\u5ba2\u3001\u7a0b\u5e8f\u5458\u7b49\u6280\u672f\u9ad8\u624b\u5728\u5f00\u6e90\u793e\u533a\u7684\u5927\u65d7\u4e0b\u7684\u516c\u5171\u667a\u6167\u7684\u7ed3\u6676\uff0c\u81ea\u5df1\u7684\u52b3\u52a8\u6210\u679c\u88ab\u5176\u4ed6\u516c\u53f8\u5546\u4e1a\u5316\u81ea\u7136\u4e5f\u4f24\u4e86\u4e00\u5927\u6279\u5f00\u6e90\u5de5\u4f5c\u8005\u7684\u5fc3\uff0c\u56e0\u6b64MySQL\u9879\u76ee\u7684\u521b\u59cb\u4eba\u91cd\u65b0\u7814\u53d1\u4e86\u4e00\u6b3e\u540d\u4e3aMariaDB\u7684\u5168\u65b0\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u3002<\/p>\n

MariaDB\u548cMySQL\u7684Logo\u5982\u56fe18-1\u6240\u793a\u3002<\/p>\n

\"marialANDmysql\"<\/p>\n

\u56fe18-1 MariaDB\u4e0eMysql\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u8457\u540dLOGO<\/p>\n

MariaDB\u662f\u7531MySQL\u9879\u76ee\u521b\u59cb\u4ebaMichael Widenius\u5e26\u9886\u7740\u56e2\u961f\u5f00\u53d1\u7684\u3002\u636eMariaDB\u5b98\u7f51\u4ecb\u7ecd\uff0cWidenius\u6709\u4e24\u4e2a\u5973\u513f\uff0c\u5927\u5973\u513f\u540d\u4e3aMy\uff08MySQL\u5f97\u540d\u4e8e\u6b64\uff09\uff0c\u4e8c\u5973\u513f\u540d\u4e3aMaria\uff0c\u56e0\u6b64\u4ed6\u5c06\u8fd9\u6b3e\u65b0\u8f6f\u4ef6\u547d\u540d\u4e3aMariaDB\uff0c\u5ef6\u7eed\u4e86\u5bb6\u65cf\u547d\u540d\u7684\u4f20\u7edf\u3002<\/p>\n

Why is the Software Called MariaDB?\r\n<\/strong>\r\nThe 'MySQL' name is trademarked by Oracle, and they have chosen to keep that trademark to themselves. The name MySQL (just like the MyISAM storage engine) comes from Monty's first daughter My. The first part of 'MySQL' is pronounced like the English adjective, even if this doesn't match the correct pronunciation of the Finnish name.\r\n\r\nMariaDB continues this tradition by being named after his younger daughter, Maria.\r\n\r\nThe name Maria was initially given to a storage engine. After MariaDB was started, to avoid confusion, it was renamed to Aria. The new name was decided as a result of a contest.\r\n<\/pre>\n

MariaDB\u7531\u5f00\u6e90\u793e\u533a\u7ef4\u62a4\uff0c\u662fMySQL\u7684\u5206\u652f\u4ea7\u54c1\uff0c\u800c\u4e14\u4e0eMySQL\u5177\u6709\u9ad8\u5ea6\u7684\u517c\u5bb9\u6027\uff0c\u4e0eMySQL API\u548c\u547d\u4ee4\u5747\u4fdd\u6301\u4e00\u81f4\u3002\u6b64\u5916\uff0cMariaDB\u8fd8\u81ea\u5e26\u4e86\u4e00\u4e2a\u65b0\u7684\u5b58\u50a8\u5f15\u64ceAria\uff0c\u7528\u4e8e\u66ff\u4ee3MyISAM\u3002\u56e0\u6b64\uff0c\u5728\u5b9e\u9645\u4f7f\u7528\u4e2d\uff0cMariaDB\u4e0eMySQL\u4e00\u6837\u597d\u7528\u3002<\/p>\n

\u4e0e\u6b64\u540c\u65f6\uff0c\u7531\u4e8e\u5404\u5927\u516c\u53f8\u4e4b\u95f4\u5b58\u5728\u7740\u7ade\u4e89\u5173\u7cfb\u6216\u5229\u76ca\u5173\u7cfb\uff0c\u5916\u52a0MySQL\u5728\u88ab\u6536\u8d2d\u4e4b\u540e\u9010\u6e10\u7531\u5f00\u6e90\u5411\u95ed\u6e90\u8f6f\u4ef6\u8f6c\u53d8\uff0c\u5f88\u591a\u516c\u53f8\u629b\u5f03\u4e86MySQL\u3002\u5f53\u524d\uff0c\u8c37\u6b4c\u3001\u7ef4\u57fa\u767e\u79d1\u7b49\u51b3\u5b9a\u5c06MySQL\u6570\u636e\u5e93\u4e0a\u7684\u4e1a\u52a1\u8f6c\u79fb\u5230MariaDB\u6570\u636e\u5e93\uff0cLinux\u5f00\u6e90\u7cfb\u7edf\u7684\u9886\u8896\u7ea2\u5e3d\u516c\u53f8\u4e5f\u51b3\u5b9a\u5728\u6700\u65b0\u7684RHEL\u3001CentOS Stream\u4ee5\u53caFedora\u7cfb\u7edf\u4e2d\uff0c\u5c06MariaDB\u4f5c\u4e3a\u9ed8\u8ba4\u7684\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u800c\u4e14\u7ea2\u5e3d\u516c\u53f8\u66f4\u662f\u5c06\u6570\u636e\u5e93\u77e5\u8bc6\u52a0\u5165\u5230\u4e86RHCE\u8ba4\u8bc1\u7684\u8003\u8bd5\u5185\u5bb9\u4e2d\u3002\u968f\u540e\uff0c\u8fd8\u6709\u6570\u5341\u4e2a\u5e38\u89c1\u7684Linux\u7cfb\u7edf\uff08\u5982openSUSE\u3001Slackware\u7b49\uff09\u4e5f\u505a\u51fa\u4e86\u540c\u6837\u7684\u8868\u6001\u3002<\/p>\n

\u5766\u767d\u6765\u8bb2\uff0c\u5c3d\u7ba1IT\u884c\u4e1a\u5de8\u5934\u90fd\u51b3\u5b9a\u91c7\u7528MariaDB\u6570\u636e\u5e93\u7ba1\u7cfb\u7edf\uff0c\u4f46\u8fd9\u5e76\u4e0d\u610f\u5473\u7740MariaDB\u8f83\u4e4b\u4e8eMySQL\u6709\u660e\u663e\u7684\u4f18\u52bf\u3002\u5218\u9044\u8001\u5e08\u7528\u4e86\u8fd1\u4e24\u5468\u7684\u65f6\u95f4\u6d4b\u8bd5\u4e86MariaDB\u4e0eMySQL\u7684\u533a\u522b\uff0c\u5e76\u8fdb\u884c\u4e86\u591a\u9879\u6027\u80fd\u6d4b\u8bd5\uff0c\u5e76\u6ca1\u6709\u53d1\u73b0\u5a92\u4f53\u6240\u8bf4\u7684\u90a3\u79cd\u660e\u663e\u7684\u4f18\u52bf\u3002\u53ef\u4ee5\u8bf4\uff0cMariaDB\u548cMySQL\u5728\u6027\u80fd\u4e0a\u57fa\u672c\u4fdd\u6301\u4e00\u81f4\uff0c\u4e24\u8005\u7684\u64cd\u4f5c\u547d\u4ee4\u4e5f\u5341\u5206\u76f8\u4f3c\u3002\u4ece\u52a1\u5b9e\u7684\u89d2\u5ea6\u6765\u8bb2\uff0c\u5728\u638c\u63e1\u4e86MariaDB\u6570\u636e\u5e93\u7684\u547d\u4ee4\u548c\u57fa\u672c\u64cd\u4f5c\u4e4b\u540e\uff0c\u5728\u672a\u6765\u5de5\u4f5c\u4e2d\u5373\u4f7f\u9047\u5230MySQL\u6570\u636e\u5e93\uff0c\u4e5f\u80fd\u8f7b\u677e\u4e0a\u624b\u3002<\/p>\n

18.2 \u521d\u59cb\u5316mariaDB\u670d\u52a1<\/strong><\/span><\/h5>\n

\u76f8\u8f83\u4e8eMySQL\uff0cMariaDB\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u6709\u4e86\u5f88\u591a\u65b0\u9c9c\u7684\u6269\u5c55\u7279\u6027\uff0c\u4f8b\u5982\u5bf9\u5fae\u79d2\u7ea7\u522b\u7684\u652f\u6301\u3001\u7ebf\u7a0b\u6c60\u3001\u5b50\u67e5\u8be2\u4f18\u5316\u3001\u8fdb\u7a0b\u62a5\u544a\u7b49\u3002\u5728\u914d\u7f6e\u59a5\u5f53\u8f6f\u4ef6\u4ed3\u5e93\u540e\uff0c\u5373\u53ef\u5b89\u88c5\u90e8\u7f72MariaDB\u6570\u636e\u5e93\u4e3b\u7a0b\u5e8f\u53ca\u670d\u52a1\u7aef\u7a0b\u5e8f\u4e86\u3002<\/p>\n

[root@linuxprobe ~]# dnf install -y mariadb mariadb-server\r\nUpdating Subscription Management repositories.\r\nUnable to read consumer identity\r\nThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.\r\nLast metadata expiration check: 0:00:19 ago on Tue 27 Apr 2021 05:04:27 PM CST.\r\nDependencies resolved.\r\n===========================================================================================\r\n Package                    Arch   Version              Repository             Size\r\n===========================================================================================\r\nInstalling:\r\n mariadb                    x86_64 3:10.3.11-1.module+el8+2765+cfa4f87b    AppStream 6.2 M\r\n mariadb-server             x86_64 3:10.3.11-1.module+el8+2765+cfa4f87b    AppStream  16 M\r\nInstalling dependencies:\r\n mariadb-common             x86_64 3:10.3.11-1.module+el8+2765+cfa4f87b    AppStream  62 k\r\n mariadb-connector-c        x86_64 3.0.7-1.el8                             AppStream 148 k\r\n mariadb-connector-c-config noarch 3.0.7-1.el8                             AppStream  13 k\r\n mariadb-errmsg             x86_64 3:10.3.11-1.module+el8+2765+cfa4f87b    AppStream 232 k\r\n perl-DBD-MySQL             x86_64 4.046-2.module+el8+2515+0650e81c        AppStream 156 k\r\nInstalling weak dependencies:\r\n mariadb-backup             x86_64 3:10.3.11-1.module+el8+2765+cfa4f87b    AppStream 6.2 M\r\n mariadb-gssapi-server      x86_64 3:10.3.11-1.module+el8+2765+cfa4f87b    AppStream  49 k\r\n mariadb-server-utils       x86_64 3:10.3.11-1.module+el8+2765+cfa4f87b    AppStream 1.6 M\r\nEnabling module streams:\r\n mariadb                           10.3                                                   \r\n perl-DBD-MySQL                    4.046                                                  \r\n\r\nTransaction Summary\r\n===========================================================================================\r\nInstall  10 Packages\r\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026\r\nInstalled:\r\n  mariadb-3:10.3.11-1.module+el8+2765+cfa4f87b.x86_64                                      \r\n  mariadb-server-3:10.3.11-1.module+el8+2765+cfa4f87b.x86_64                               \r\n  mariadb-backup-3:10.3.11-1.module+el8+2765+cfa4f87b.x86_64                               \r\n  mariadb-gssapi-server-3:10.3.11-1.module+el8+2765+cfa4f87b.x86_64                        \r\n  mariadb-server-utils-3:10.3.11-1.module+el8+2765+cfa4f87b.x86_64                         \r\n  mariadb-common-3:10.3.11-1.module+el8+2765+cfa4f87b.x86_64                               \r\n  mariadb-connector-c-3.0.7-1.el8.x86_64                                                   \r\n  mariadb-connector-c-config-3.0.7-1.el8.noarch                                            \r\n  mariadb-errmsg-3:10.3.11-1.module+el8+2765+cfa4f87b.x86_64                               \r\n  perl-DBD-MySQL-4.046-2.module+el8+2515+0650e81c.x86_64                                   \r\n\r\nComplete!<\/pre>\n

\u5728\u5b89\u88c5\u5b8c\u6bd5\u540e\uff0c\u8bb0\u5f97\u542f\u52a8\u670d\u52a1\u7a0b\u5e8f\uff0c\u5e76\u5c06\u5176\u52a0\u5165\u5230\u5f00\u673a\u542f\u52a8\u9879\u4e2d\uff1a<\/p>\n

[root@linuxprobe ~]# systemctl start  mariadb \r\n[root@linuxprobe ~]# systemctl enable mariadb \r\nCreated symlink \/etc\/systemd\/system\/mysql.service \u2192 \/usr\/lib\/systemd\/system\/mariadb.service.\r\nCreated symlink \/etc\/systemd\/system\/mysqld.service \u2192 \/usr\/lib\/systemd\/system\/mariadb.service.\r\nCreated symlink \/etc\/systemd\/system\/multi-user.target.wants\/mariadb.service \u2192 \/usr\/lib\/systemd\/system\/mariadb.service.\r\n<\/pre>\n

\u5728\u786e\u8ba4mariadb\u6570\u636e\u5e93\u8f6f\u4ef6\u7a0b\u5e8f\u5b89\u88c5\u5b8c\u6bd5\u5e76\u6210\u529f\u542f\u52a8\u540e\u8bf7\u4e0d\u8981\u7acb\u5373\u4f7f\u7528\u3002\u4e3a\u4e86\u786e\u4fdd\u6570\u636e\u5e93\u7684\u5b89\u5168\u6027\u548c\u6b63\u5e38\u8fd0\u8f6c\uff0c\u9700\u8981\u5148\u5bf9\u6570\u636e\u5e93\u7a0b\u5e8f\u8fdb\u884c\u521d\u59cb\u5316\u64cd\u4f5c\u3002\u8fd9\u4e2a\u521d\u59cb\u5316\u64cd\u4f5c\u6d89\u53ca\u4e0b\u97625\u4e2a\u6b65\u9aa4\u3002<\/p>\n

\u8bbe\u7f6eroot\u7ba1\u7406\u5458\u5728\u6570\u636e\u5e93\u4e2d\u7684\u5bc6\u7801\u503c\uff08\u6ce8\u610f\uff0c\u8be5\u5bc6\u7801\u5e76\u975eroot\u7ba1\u7406\u5458\u5728\u7cfb\u7edf\u4e2d\u7684\u5bc6\u7801\uff0c\u8fd9\u91cc\u7684\u5bc6\u7801\u503c\u9ed8\u8ba4\u5e94\u8be5\u4e3a\u7a7a\uff0c\u53ef\u76f4\u63a5\u6309\u56de\u8f66\u952e\uff09\u3002<\/p>\n

\u8bbe\u7f6eroot\u7ba1\u7406\u5458\u5728\u6570\u636e\u5e93\u4e2d\u7684\u4e13\u6709\u5bc6\u7801\u3002<\/p>\n

\u5220\u9664\u533f\u540d\u7528\u6237\uff0c\u5e76\u4f7f\u7528root\u7ba1\u7406\u5458\u4ece\u8fdc\u7a0b\u767b\u5f55\u6570\u636e\u5e93\uff0c\u4ee5\u786e\u4fdd\u6570\u636e\u5e93\u4e0a\u8fd0\u884c\u7684\u4e1a\u52a1\u7684\u5b89\u5168\u6027\u3002<\/p>\n

\u5220\u9664\u9ed8\u8ba4\u7684\u6d4b\u8bd5\u6570\u636e\u5e93\uff0c\u53d6\u6d88\u6d4b\u8bd5\u6570\u636e\u5e93\u7684\u4e00\u7cfb\u5217\u8bbf\u95ee\u6743\u9650\u3002<\/p>\n

\u5237\u65b0\u6388\u6743\u5217\u8868\uff0c\u8ba9\u521d\u59cb\u5316\u7684\u8bbe\u5b9a\u7acb\u5373\u751f\u6548\u3002<\/p><\/blockquote>\n

\u5bf9\u4e8e\u4e0a\u8ff0\u6570\u636e\u5e93\u521d\u59cb\u5316\u7684\u64cd\u4f5c\u6b65\u9aa4\uff0c\u5728\u8f93\u51fa\u4fe1\u606f\u65c1\u8fb9\u8fdb\u884c\u4e86\u7b80\u5355\u6ce8\u91ca\uff0c\u786e\u4fdd\u5404\u4f4d\u8bfb\u8005\u66f4\u76f4\u89c2\u5730\u4e86\u89e3\u8981\u8f93\u5165\u7684\u5185\u5bb9\uff1a<\/p>\n

[root@linuxprobe ~]# mysql_secure_installation \r\n\r\nNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB\r\n      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!\r\n\r\nIn order to log into MariaDB to secure it, we'll need the current\r\npassword for the root user.  If you've just installed MariaDB, and\r\nyou haven't set the root password yet, the password will be blank,\r\nso you should just press enter here.\r\n\r\nEnter current password for root (enter for none): \u8f93\u5165\u7ba1\u7406\u5458\u539f\u59cb\u5bc6\u7801\uff0c\u9ed8\u8ba4\u4e3a\u7a7a\u503c\uff0c\u76f4\u63a5\u56de\u8f66\u5373\u53ef<\/strong>\r\nOK, successfully used password, moving on...\r\n\r\nSetting the root password ensures that nobody can log into the MariaDB\r\nroot user without the proper authorisation.\r\n\r\nSet root password? [Y\/n] y\uff08\u8bbe\u7f6e\u7ba1\u7406\u5458\u5bc6\u7801\uff09<\/strong>\r\nNew password: \u8f93\u5165\u65b0\u7684\u5bc6\u7801<\/strong>\r\nRe-enter new password: \u518d\u6b21\u8f93\u5165\u5bc6\u7801<\/strong>\r\nPassword updated successfully!\r\nReloading privilege tables..\r\n ... Success!\r\n\r\n\r\nBy default, a MariaDB installation has an anonymous user, allowing anyone\r\nto log into MariaDB without having to have a user account created for\r\nthem.  This is intended only for testing, and to make the installation\r\ngo a bit smoother.  You should remove them before moving into a\r\nproduction environment.\r\n\r\nRemove anonymous users? [Y\/n] y\uff08\u5220\u9664\u533f\u540d\u8d26\u6237\uff09<\/strong>\r\n ... Success!\r\n\r\nNormally, root should only be allowed to connect from 'localhost'.  This\r\nensures that someone cannot guess at the root password from the network.\r\n\r\nDisallow root login remotely? [Y\/n] y\uff08\u7981\u6b62\u7ba1\u7406\u5458\u4ece\u8fdc\u7a0b\u767b\u5f55\uff09<\/strong>\r\n ... Success!\r\n\r\nBy default, MariaDB comes with a database named 'test' that anyone can\r\naccess.  This is also intended only for testing, and should be removed\r\nbefore moving into a production environment.\r\n\r\nRemove test database and access to it? [Y\/n] y\uff08\u5220\u9664\u6d4b\u8bd5\u6570\u636e\u5e93\u53ca\u5176\u8bbf\u95ee\u6743\u9650\uff09<\/strong>\r\n - Dropping test database...\r\n ... Success!\r\n - Removing privileges on test database...\r\n ... Success!\r\n\r\nReloading the privilege tables will ensure that all changes made so far\r\nwill take effect immediately.\r\n\r\nReload privilege tables now? [Y\/n] y\uff08\u5237\u65b0\u6388\u6743\u8868\uff0c\u8ba9\u521d\u59cb\u5316\u540e\u7684\u8bbe\u5b9a\u7acb\u5373\u751f\u6548\uff09<\/strong>\r\n ... Success!\r\n\r\nCleaning up...\r\n\r\nAll done!  If you've completed all of the above steps, your MariaDB\r\ninstallation should now be secure.\r\n\r\nThanks for using MariaDB!\r\n<\/pre>\n

\u5728\u5f88\u591a\u751f\u4ea7\u73af\u5883\u4e2d\u90fd\u9700\u8981\u4f7f\u7528\u7ad9\u5e93\u5206\u79bb\u7684\u6280\u672f\uff08\u5373\u7f51\u7ad9\u548c\u6570\u636e\u5e93\u4e0d\u5728\u540c\u4e00\u4e2a\u670d\u52a1\u5668\u4e0a\uff09\uff0c\u5982\u679c\u9700\u8981\u8ba9root\u7ba1\u7406\u5458\u8fdc\u7a0b\u8bbf\u95ee\u6570\u636e\u5e93\uff0c\u53ef\u5728\u4e0a\u9762\u7684\u521d\u59cb\u5316\u64cd\u4f5c\u4e2d\u8bbe\u7f6e\u7b56\u7565\uff0c\u4ee5\u5141\u8bb8root\u7ba1\u7406\u5458\u4ece\u8fdc\u7a0b\u8bbf\u95ee\u3002\u7136\u540e\u8fd8\u9700\u8981\u8bbe\u7f6e\u9632\u706b\u5899\uff0c\u4f7f\u5176\u653e\u884c\u5bf9\u6570\u636e\u5e93\u670d\u52a1\u7a0b\u5e8f\u7684\u8bbf\u95ee\u8bf7\u6c42\u3002\u6570\u636e\u5e93\u670d\u52a1\u7a0b\u5e8f\u9ed8\u8ba4\u4f1a\u5360\u75283306\u7aef\u53e3\uff0c\u5728\u9632\u706b\u5899\u7b56\u7565\u4e2d\u670d\u52a1\u540d\u79f0\u7edf\u4e00\u53eb\u4f5cmysql\uff1a<\/p>\n

[root@linuxprobe ~]# firewall-cmd --permanent --add-service=mysql\r\nsuccess\r\n[root@linuxprobe ~]# firewall-cmd --reload\r\nsuccess\r\n<\/pre>\n

\u4e00\u5207\u51c6\u5907\u5c31\u7eea\u3002\u73b0\u5728\u6211\u4eec\u5c06\u9996\u6b21\u767b\u5f55MariaDB\u6570\u636e\u5e93\u3002\u7ba1\u7406\u6570\u636e\u5e93\u7684\u547d\u4ee4\u4e3amysql\uff0c\u5176\u4e2d\uff0c-u\u53c2\u6570\u7528\u6765\u6307\u5b9a\u4ee5root\u7ba1\u7406\u5458\u7684\u8eab\u4efd\u767b\u5f55\uff0c\u800c-p\u53c2\u6570\u7528\u6765\u9a8c\u8bc1\u8be5\u7528\u6237\u5728\u6570\u636e\u5e93\u4e2d\u7684\u5bc6\u7801\u503c\u3002<\/p>\n

[root@linuxprobe ~]# mysql -u root -p\r\nEnter password: \u8f93\u5165\u521a\u624d\u8bbe\u7f6e\u7684\u7ba1\u7406\u5458\u5bc6\u7801\u540e\u6572\u51fb\u56de\u8f66<\/strong>\r\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\r\nYour MariaDB connection id is 16\r\nServer version: 10.3.11-MariaDB MariaDB Server\r\n\r\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n<\/pre>\n

\u521d\u6b21\u4f7f\u7528\u6570\u636e\u5e93\u7ba1\u7406\u5de5\u5177\u7684\u8bfb\u8005\uff0c\u53ef\u4ee5\u8f93\u5165help\u547d\u4ee4\u67e5\u770bmariadb\u670d\u52a1\u80fd\u505a\u7684\u64cd\u4f5c\uff0c\u8bed\u53e5\u7684\u7528\u6cd5\u4e0eMySQL\u4e00\u6a21\u4e00\u6837\uff1a<\/p>\n

MariaDB [(none)]> help\r\n\r\nGeneral information about MariaDB can be found at http:\/\/mariadb.org\r\n\r\nList of all MySQL commands:\r\nNote that all text commands must be first on line and end with ';'\r\n?         (\\?) Synonym for `help'.\r\nclear     (\\c) Clear the current input statement.\r\nconnect   (\\r) Reconnect to the server. Optional arguments are db and host.\r\ndelimiter (\\d) Set statement delimiter.\r\nedit      (\\e) Edit command with $EDITOR.\r\nego       (\\G) Send command to mysql server, display result vertically.\r\nexit      (\\q) Exit mysql. Same as quit.\r\ngo        (\\g) Send command to mysql server.\r\nhelp      (\\h) Display this help.\r\nnopager   (\\n) Disable pager, print to stdout.\r\nnotee     (\\t) Don't write into outfile.\r\npager     (\\P) Set PAGER [to_pager]. Print the query results via PAGER.\r\nprint     (\\p) Print current command.\r\nprompt    (\\R) Change your mysql prompt.\r\nquit      (\\q) Quit mysql.\r\nrehash    (\\#) Rebuild completion hash.\r\nsource    (\\.) Execute an SQL script file. Takes a file name as an argument.\r\nstatus    (\\s) Get status information from the server.\r\nsystem    (\\!) Execute a system shell command.\r\ntee       (\\T) Set outfile [to_outfile]. Append everything into given outfile.\r\nuse       (\\u) Use another database. Takes database name as argument.\r\ncharset   (\\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.\r\nwarnings  (\\W) Show warnings after every statement.\r\nnowarning (\\w) Don't show warnings after every statement.\r\n\r\nFor server side help, type 'help contents'\r\n<\/pre>\n

\u5728\u767b\u5f55MariaDB\u6570\u636e\u5e93\u540e\u6267\u884c\u6570\u636e\u5e93\u547d\u4ee4\u65f6\uff0c\u90fd\u9700\u8981\u5728\u547d\u4ee4\u540e\u9762\u7528\u5206\u53f7\uff08;\uff09\u7ed3\u5c3e\uff0c\u8fd9\u4e5f\u662f\u4e0eLinux\u547d\u4ee4\u6700\u663e\u8457\u7684\u533a\u522b\u3002\u5927\u5bb6\u9700\u8981\u6162\u6162\u4e60\u60ef\u6570\u636e\u5e93\u547d\u4ee4\u7684\u8fd9\u79cd\u8bbe\u5b9a\u3002\u4e0b\u9762\u6267\u884c\u5982\u4e0b\u547d\u4ee4\u67e5\u770b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u4e2d\u5f53\u524d\u90fd\u6709\u54ea\u4e9b\u6570\u636e\u5e93\uff1a<\/p>\n

MariaDB [(none)]> SHOW databases;\r\n+--------------------+\r\n| Database           |\r\n+--------------------+\r\n| information_schema |\r\n| mysql              |\r\n| performance_schema |\r\n+--------------------+\r\n3 rows in set (0.000 sec)\r\n<\/pre>\n

\u5c0f\u8bd5\u725b\u5200\u8fc7\u540e\uff0c\u63a5\u4e0b\u6765\u4f7f\u7528\u6570\u636e\u5e93\u547d\u4ee4\u5c06root\u7ba1\u7406\u5458\u5728\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u4e2d\u7684\u5bc6\u7801\u503c\u4fee\u6539\u4e3alinuxprobe\u3002\u8fd9\u6837\u9000\u51fa\u540e\u518d\u5c1d\u8bd5\u767b\u5f55\uff0c\u5982\u679c\u8fd8\u575a\u6301\u8f93\u5165\u539f\u5148\u7684\u5bc6\u7801\uff0c\u5219\u5c06\u63d0\u793a\u8bbf\u95ee\u5931\u8d25\u3002<\/p>\n

MariaDB [(none)]> SET password = PASSWORD('linuxprobe');\r\nQuery OK, 0 rows affected (0.001 sec)\r\n\r\nMariaDB [(none)]> exit\r\nBye\r\n[root@linuxprobe ~]# mysql -u root -p\r\nEnter password: \u6b64\u5904\u8f93\u5165\u7ba1\u7406\u5458\u5728\u6570\u636e\u5e93\u4e2d\u7684\u65e7\u5bc6\u7801<\/strong>\r\nERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)\r\n<\/pre>\n

\u8f93\u5165\u65b0\u5bc6\u7801\uff08linuxprobe\uff09\u540e\uff0c\u4fbf\u53ef\u987a\u5229\u8fdb\u5165\u6570\u636e\u5e93\u7ba1\u7406\u5de5\u5177\u4e2d\uff1a<\/p>\n

[root@linuxprobe ~]# mysql -u root -p\r\nEnter password: \u6b64\u5904\u8f93\u5165\u7ba1\u7406\u5458\u5728\u6570\u636e\u5e93\u4e2d\u7684\u65b0\u5bc6\u7801<\/strong>\r\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\r\nYour MariaDB connection id is 20\r\nServer version: 10.3.11-MariaDB MariaDB Server\r\n\r\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n<\/pre>\n

\u51fa\u73b0\u95ee\u9898?\u5927\u80c6\u63d0\u95ee!<\/strong><\/span><\/p>\n

\u56e0\u8bfb\u8005\u4eec\u786c\u4ef6\u4e0d\u540c\u6216\u64cd\u4f5c\u9519\u8bef\u90fd\u53ef\u80fd\u5bfc\u81f4\u5b9e\u9a8c\u914d\u7f6e\u51fa\u9519\uff0c\u8bf7\u8010\u5fc3\u518d\u4ed4\u7ec6\u770b\u770b\u64cd\u4f5c\u6b65\u9aa4\u5427\uff0c\u4e0d\u8981\u6c14\u9981~<\/p>\n

Linux\u6280\u672f\u4ea4\u6d41\u5b66\u4e60\u8bf7\u52a0\u8bfb\u8005\u7fa4\uff08\u63a8\u8350<\/span><\/strong>\uff09\uff1ahttps:\/\/lrxjmw.cn\/club<\/a><\/p>\n

*\u672c\u7fa4\u7279\u8272\uff1a\u786e\u4fdd\u6bcf\u4e00\u4f4d\u7fa4\u53cb\u90fd\u662f\u300aLinux\u5c31\u8be5\u8fd9\u4e48\u5b66\u300b\u7684\u8bfb\u8005\uff0c\u7b54\u7591\u66f4\u6709\u9488\u5bf9\u6027\uff0c\u4e0d\u5b9a\u671f\u9886\u53d6\u5b9a\u5236\u793c\u54c1\u3002<\/p><\/blockquote>\n

18.3\u00a0\u7ba1\u7406\u7528\u6237\u4ee5\u53ca\u6388\u6743<\/span><\/strong><\/h5>\n

\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u603b\u4e0d\u80fd\u4e00\u76f4\u201c\u6b7b\u5543\u201droot\u7ba1\u7406\u5458\u3002\u4e3a\u4e86\u4fdd\u969c\u6570\u636e\u5e93\u7cfb\u7edf\u7684\u5b89\u5168\u6027\uff0c\u4ee5\u53ca\u8ba9\u5176\u4ed6\u7528\u6237\u534f\u540c\u7ba1\u7406\u6570\u636e\u5e93\uff0c\u53ef\u4ee5\u5728MariaDB\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u4e2d\u4e3a\u4ed6\u4eec\u521b\u5efa\u591a\u4e2a\u4e13\u7528\u7684\u6570\u636e\u5e93\u7ba1\u7406\u7528\u6237\uff0c\u7136\u540e\u518d\u5206\u914d\u5408\u7406\u7684\u6743\u9650\uff0c\u4ee5\u6ee1\u8db3\u4ed6\u4eec\u7684\u5de5\u4f5c\u9700\u6c42\u3002\u4e3a\u6b64\uff0c\u53ef\u4f7f\u7528root\u7ba1\u7406\u5458\u767b\u5f55\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u7136\u540e\u6309\u7167\u201cCREATE USER\u7528\u6237\u540d@\u4e3b\u673a\u540dIDENTIFIED BY '\u5bc6\u7801';\u201d\u7684\u683c\u5f0f\u521b\u5efa\u6570\u636e\u5e93\u7ba1\u7406\u7528\u6237\u3002\u518d\u6b21\u63d0\u9192\u5927\u5bb6\uff0c\u4e00\u5b9a\u4e0d\u8981\u5fd8\u8bb0\u6bcf\u6761\u6570\u636e\u5e93\u547d\u4ee4\u540e\u9762\u7684\u5206\u53f7\uff08;\uff09\u3002<\/p>\n

MariaDB [(none)]> CREATE USER luke@localhost IDENTIFIED BY 'linuxprobe';\r\nQuery OK, 0 rows affected (0.00 sec)<\/pre>\n

\u521b\u5efa\u7684\u7528\u6237\u4fe1\u606f\u53ef\u4ee5\u4f7f\u7528SELECT\u547d\u4ee4\u8bed\u53e5\u6765\u67e5\u8be2\u3002\u4e0b\u9762\u547d\u4ee4\u67e5\u8be2\u7684\u662f\u7528\u6237luke\u7684\u4e3b\u673a\u540d\u79f0\u3001\u7528\u6237\u540d\u79f0\u4ee5\u53ca\u7ecf\u8fc7\u52a0\u5bc6\u7684\u5bc6\u7801\u503c\u4fe1\u606f\uff1a<\/p>\n

MariaDB [(none)]> use mysql;\r\nDatabase changed\r\nMariaDB [mysql]> SELECT HOST,USER,PASSWORD FROM user WHERE USER=\"luke\";\r\n+-----------+------+-------------------------------------------+\r\n| HOST      | USER | PASSWORD                                  |\r\n+-----------+------+-------------------------------------------+\r\n| localhost | luke | *55D9962586BE75F4B7D421E6655973DB07D6869F |\r\n+-----------+------+-------------------------------------------+\r\n1 row in set (0.001 sec)\r\n<\/pre>\n

\u4e0d\u8fc7\uff0c\u7528\u6237luke\u4ec5\u4ec5\u662f\u4e00\u4f4d\u666e\u901a\u7528\u6237\uff0c\u6ca1\u6709\u6570\u636e\u5e93\u7684\u4efb\u4f55\u64cd\u4f5c\u6743\u9650\u3002\u4e0d\u4fe1\u7684\u8bdd\uff0c\u5207\u6362\u5230luke\u7528\u6237\u6765\u67e5\u8be2\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u4e2d\u5f53\u524d\u90fd\u6709\u54ea\u4e9b\u6570\u636e\u5e93\u3002\u53ef\u4ee5\u53d1\u73b0\uff0c\u8be5\u7528\u6237\u751a\u81f3\u6ca1\u6cd5\u67e5\u770b\u5b8c\u6574\u7684\u6570\u636e\u5e93\u5217\u8868\uff08\u521a\u624d\u4f7f\u7528root\u7528\u6237\u65f6\u80fd\u67e5\u770b\u52303\u4e2a\u6570\u636e\u5e93\u5217\u8868\uff09\uff1a<\/p>\n

MariaDB [mysql]> exit\r\nBye\r\n[root@linuxprobe ~]# mysql -u luke -p\r\nEnter password: \u8f93\u5165luke\u7528\u6237\u7684\u6570\u636e\u5e93\u5bc6\u7801<\/strong>\r\nWelcome to the MariaDB monitor.  Commands end with ; or \\g.\r\nYour MariaDB connection id is 21\r\nServer version: 10.3.11-MariaDB MariaDB Server\r\n\r\nCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n\r\nMariaDB [(none)]> SHOW databases;\r\n+--------------------+\r\n| Database           |\r\n+--------------------+\r\n| information_schema |\r\n+--------------------+\r\n1 row in set (0.001 sec)\r\n<\/pre>\n

\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u6240\u4f7f\u7528\u7684\u547d\u4ee4\u4e00\u822c\u90fd\u6bd4\u8f83\u590d\u6742\u3002\u6211\u4eec\u4ee5GRANT\u547d\u4ee4\u4e3a\u4f8b\u8fdb\u884c\u8bf4\u660e\u3002GRANT\u547d\u4ee4\u7528\u4e8e\u4e3a\u7528\u6237\u8fdb\u884c\u6388\u6743\uff0c\u5176\u5e38\u89c1\u683c\u5f0f\u5982\u886818-1\u6240\u793a\u3002\u5728\u4f7f\u7528GRANT\u547d\u4ee4\u65f6\u9700\u8981\u5199\u4e0a\u8981\u8d4b\u4e88\u7684\u6743\u9650\u3001\u6570\u636e\u5e93\u53ca\u8868\u5355\u540d\u79f0\uff0c\u4ee5\u53ca\u5bf9\u5e94\u7684\u7528\u6237\u53ca\u4e3b\u673a\u4fe1\u606f\u3002\u5176\u5b9e\uff0c\u53ea\u8981\u7406\u89e3\u4e86\u547d\u4ee4\u4e2d\u6bcf\u4e2a\u5b57\u6bb5\u7684\u529f\u80fd\u542b\u4e49\uff0c\u4e5f\u5c31\u4e0d\u89c9\u5f97\u547d\u4ee4\u590d\u6742\u96be\u61c2\u4e86\u3002<\/p>\n

\u886818-1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 GRANT\u547d\u4ee4\u7684\u5e38\u89c1\u683c\u5f0f\u4ee5\u53ca\u89e3\u91ca<\/p>\n\n\n\n\n\n\n\n\n
\u547d\u4ee4<\/td>\n\u4f5c\u7528<\/td>\n<\/tr>\n
GRANT \u6743\u9650 ON \u6570\u636e\u5e93.\u8868\u5355\u540d\u79f0 TO \u7528\u6237\u540d@\u4e3b\u673a\u540d<\/td>\n\u5bf9\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u4e2d\u7684\u7279\u5b9a\u8868\u5355\u7ed9\u4e88\u6388\u6743<\/td>\n<\/tr>\n
GRANT \u6743\u9650 ON \u6570\u636e\u5e93.* TO \u7528\u6237\u540d@\u4e3b\u673a\u540d<\/td>\n\u5bf9\u67d0\u4e2a\u7279\u5b9a\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\u5355\u7ed9\u4e88\u6388\u6743<\/td>\n<\/tr>\n
GRANT \u6743\u9650 ON *.* TO \u7528\u6237\u540d@\u4e3b\u673a\u540d<\/td>\n\u5bf9\u6240\u6709\u6570\u636e\u5e93\u53ca\u6240\u6709\u8868\u5355\u7ed9\u4e88\u6388\u6743<\/td>\n<\/tr>\n
GRANT \u6743\u96501,\u6743\u96502 ON \u6570\u636e\u5e93.* TO \u7528\u6237\u540d@\u4e3b\u673a\u540d<\/td>\n\u5bf9\u67d0\u4e2a\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\u8868\u5355\u7ed9\u4e88\u591a\u4e2a\u6388\u6743<\/td>\n<\/tr>\n
GRANT ALL PRIVILEGES ON *.* TO \u7528\u6237\u540d@\u4e3b\u673a\u540d<\/td>\n\u5bf9\u6240\u6709\u6570\u636e\u5e93\u53ca\u6240\u6709\u8868\u5355\u7ed9\u4e88\u5168\u90e8\u6388\u6743\uff08\u9700\u8c28\u614e\u64cd\u4f5c\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

<\/p>\n

\u5f53\u7136\uff0c\u7528\u6237\u7684\u6388\u6743\u5de5\u4f5c\u80af\u5b9a\u662f\u9700\u8981\u6570\u636e\u5e93\u7ba1\u7406\u5458\u6765\u6267\u884c\u7684\u3002\u4e0b\u9762\u4ee5root\u7ba1\u7406\u5458\u7684\u8eab\u4efd\u767b\u5f55\u5230\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u4e2d\uff0c\u9488\u5bf9mysql\u6570\u636e\u5e93\u4e2d\u7684user\u8868\u5355\u5411\u7528\u6237luke\u6388\u4e88\u67e5\u8be2\u3001\u66f4\u65b0\u3001\u5220\u9664\u4ee5\u53ca\u63d2\u5165\u7b49\u6743\u9650\u3002<\/p>\n

\u5218\u9044\u8001\u5e08\u7279\u522b\u61c2\u540c\u5b66\u4eec\u73b0\u5728\u5fc3\u91cc\u60f3\u4ec0\u4e48\u3002\u6211\u8d77\u521d\u4e5f\u89c9\u5f97\u5728\u6bcf\u6761\u6570\u636e\u5e93\u547d\u4ee4\u540e\u90fd\u8981\u52a0\u4e0a\u5206\u53f7\uff08;\uff09\u7279\u522b\u4e0d\u65b9\u4fbf\uff0c\u65f6\u5e38\u8fd8\u4f1a\u5fd8\u8bb0\uff0c\u4f46\u6572\u7684\u547d\u4ee4\u591a\u4e86\u4e5f\u5c31\u81ea\u7136\u4e60\u60ef\u4e86\u3002<\/p>\n

[root@linuxprobe ~]# mysql -u root -p\r\nEnter password: \u8f93\u5165\u7ba1\u7406\u5458\u7684\u6570\u636e\u5e93\u5bc6\u7801<\/strong>\r\nMariaDB [(none)]> use mysql;\r\nReading table information for completion of table and column names\r\nYou can turn off this feature to get a quicker startup with -A\r\nDatabase changed\r\nMariaDB [mysql]> GRANT SELECT,UPDATE,DELETE,INSERT ON mysql.user TO luke@localhost;\r\nQuery OK, 0 rows affected (0.001 sec)\r\n<\/pre>\n

\u5728\u6267\u884c\u5b8c\u4e0a\u8ff0\u6388\u6743\u64cd\u4f5c\u4e4b\u540e\uff0c\u518d\u67e5\u770b\u4e0b\u7528\u6237luke\u7684\u6743\u9650\uff1a<\/p>\n

MariaDB [(none)]>\u00a0 SHOW\u00a0GRANTS\u00a0FOR\u00a0luke@localhost;\r\n+---------------------------------------------------------------------------------------------+\r\n| Grants for luke@localhost                                                                   |\r\n+---------------------------------------------------------------------------------------------+\r\n| GRANT USAGE ON *.* TO 'luke'@'localhost' IDENTIFIED BY PASSWORD '*55D9962586BE75F4B7D421E6655973DB07D6869F' |\r\n| GRANT SELECT, INSERT, UPDATE, DELETE ON `mysql`.`user` TO 'luke'@'localhost'                |\r\n+---------------------------------------------------------------------------------------------+\r\n2 rows in set (0.000 sec)\r\n<\/pre>\n

\u4e0a\u9762\u8f93\u51fa\u4fe1\u606f\u4e2d\u663e\u793a\u7528\u6237luke\u5df2\u7ecf\u62e5\u6709\u4e86\u9488\u5bf9mysql\u6570\u636e\u5e93\u4e2duser\u8868\u5355\u7684\u4e00\u7cfb\u5217\u6743\u9650\u4e86\u3002\u8fd9\u65f6\u6211\u4eec\u518d\u5207\u6362\u5230\u7528\u6237luke\uff0c\u6b64\u65f6\u5c31\u80fd\u770b\u5230mysql\u6570\u636e\u5e93\u4e86\uff0c\u800c\u4e14\u8fd8\u80fd\u770b\u5230\u8868\u5355user\uff08\u5176\u4f59\u8868\u5355\u4f1a\u56e0\u65e0\u6743\u9650\u800c\u88ab\u7ee7\u7eed\u9690\u85cf\uff09\uff1a<\/p>\n

[root@linuxprobe ~]# mysql -u luke -p\r\nEnter password: \u8f93\u5165luke\u7528\u6237\u7684\u6570\u636e\u5e93\u5bc6\u7801<\/strong>\r\n\r\nMariaDB [(none)]> SHOW databases;\r\n+--------------------+\r\n| Database           |\r\n+--------------------+\r\n| information_schema |\r\n| mysql              |\r\n+--------------------+\r\n2 rows in set (0.000 sec)\r\n\r\nMariaDB [(none)]> use mysql;\r\nDatabase changed\r\n\r\nMariaDB [mysql]> SHOW tables;\r\n+-----------------+\r\n| Tables_in_mysql |\r\n+-----------------+\r\n| user            |\r\n+-----------------+\r\n1 row in set (0.001 sec)\r\n\r\nMariaDB [mysql]> exit\r\nByes\r\n<\/pre>\n

\u5927\u5bb6\u4e0d\u8981\u5fc3\u6025\uff0c\u6211\u4eec\u63a5\u4e0b\u6765\u4f1a\u6162\u6162\u5b66\u4e60\u6570\u636e\u5e93\u5185\u5bb9\u7684\u4fee\u6539\u65b9\u6cd5\u3002\u5f53\u524d\uff0c\u5148\u5207\u6362\u56deroot\u7ba1\u7406\u5458\u7528\u6237\uff0c\u79fb\u9664\u521a\u624d\u7684\u6388\u6743\u3002<\/p>\n

[root@linuxprobe ~]# mysql -u root -p\r\nEnter password: \u8f93\u5165\u7ba1\u7406\u5458\u7684\u6570\u636e\u5e93\u5bc6\u7801<\/strong>\r\nMariaDB [(none)]> use mysql;\r\nDatabase changed\r\nMariaDB [(none)]> REVOKE\u00a0SELECT,UPDATE,DELETE,INSERT\u00a0ON\u00a0mysql.user\u00a0FROM\u00a0luke@localhost;\r\nQuery OK, 0 rows affected (0.00 sec)<\/pre>\n

\u53ef\u4ee5\u770b\u5230\uff0c\u9664\u4e86\u79fb\u9664\u6388\u6743\u7684\u547d\u4ee4\uff08REVOKE\uff09\u4e0e\u6388\u6743\u547d\u4ee4\uff08GRANTS\uff09\u4e0d\u540c\u4e4b\u5916\uff0c\u5176\u4f59\u90e8\u5206\u90fd\u662f\u4e00\u81f4\u7684\u3002\u8fd9\u4e0d\u4ec5\u597d\u8bb0\u800c\u4e14\u4e5f\u5bb9\u6613\u7406\u89e3\u3002\u6267\u884c\u79fb\u9664\u6388\u6743\u547d\u4ee4\u540e\uff0c\u518d\u6765\u67e5\u770b\u7528\u6237luke\u7684\u4fe1\u606f\uff1a<\/p>\n

MariaDB [(none)]> SHOW\u00a0GRANTS\u00a0FOR\u00a0luke@localhost;\r\n+---------------------------------------------------------------------------------------------+\r\n| Grants for luke@localhost                                                                   |\r\n+---------------------------------------------------------------------------------------------+\r\n| GRANT USAGE ON *.* TO 'luke'@'localhost' IDENTIFIED BY PASSWORD '*55D9962586BE75F4B7D421E6655973DB07D6869F' |\r\n+---------------------------------------------------------------------------------------------+\r\n1 row in set (0.001 sec)\r\n<\/pre>\n

\u4e0d\u518d\u9700\u8981\u67d0\u4e2a\u7528\u6237\u65f6\uff0c\u5219\u76f4\u63a5\u7528DROP\u547d\u4ee4\u5c06\u5176\u5220\u9664\uff1a<\/p>\n

MariaDB [(none)]> DROP user luke@localhost;\r\nQuery OK, 0 rows affected (0.000 sec)\r\n<\/pre>\n
18.4 \u521b\u5efa\u6570\u636e\u5e93\u4e0e\u8868\u5355<\/span><\/strong><\/h5>\n

\u5728MariaDB\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u4e2d\uff0c\u4e00\u4e2a\u6570\u636e\u5e93\u80fd\u591f\u5b58\u653e\u591a\u4e2a\u6570\u636e\u8868\uff0c\u6570\u636e\u8868\u5355\u662f\u6570\u636e\u5e93\u4e2d\u6700\u91cd\u8981\u6700\u6838\u5fc3\u7684\u5185\u5bb9\u3002\u6211\u4eec\u53ef\u4ee5\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u81ea\u5b9a\u4e49\u6570\u636e\u5e93\u8868\u7ed3\u6784\uff0c\u7136\u540e\u5728\u5176\u4e2d\u5408\u7406\u5730\u5b58\u653e\u6570\u636e\uff0c\u4ee5\u4fbf\u540e\u671f\u8f7b\u677e\u5730\u7ef4\u62a4\u548c\u4fee\u6539\u3002\u886818-2\u7f57\u5217\u4e86\u540e\u6587\u4e2d\u5c06\u4f7f\u7528\u5230\u7684\u6570\u636e\u5e93\u547d\u4ee4\u4ee5\u53ca\u5bf9\u5e94\u7684\u4f5c\u7528\u3002<\/p>\n

\u886818-2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u7528\u4e8e\u521b\u5efa\u6570\u636e\u5e93\u7684\u547d\u4ee4\u4ee5\u53ca\u4f5c\u7528<\/p>\n\n\n\n\n\n\n\n\n\n\n\n
\u547d\u4ee4\u7528\u6cd5<\/td>\n\u4f5c\u7528<\/td>\n<\/tr>\n
CREATE database \u6570\u636e\u5e93\u540d\u79f0\u3002<\/td>\n\u521b\u5efa\u65b0\u7684\u6570\u636e\u5e93<\/td>\n<\/tr>\n
DESCRIBE \u8868\u5355\u540d\u79f0;<\/td>\n\u63cf\u8ff0\u8868\u5355<\/td>\n<\/tr>\n
UPDATE \u8868\u5355\u540d\u79f0 SET attribute=\u65b0\u503c WHERE attribute > \u539f\u59cb\u503c;<\/td>\n\u66f4\u65b0\u8868\u5355\u4e2d\u7684\u6570\u636e<\/td>\n<\/tr>\n
USE \u6570\u636e\u5e93\u540d\u79f0;<\/td>\n\u6307\u5b9a\u4f7f\u7528\u7684\u6570\u636e\u5e93<\/td>\n<\/tr>\n
SHOW databases;<\/td>\n\u663e\u793a\u5f53\u524d\u5df2\u6709\u7684\u6570\u636e\u5e93<\/td>\n<\/tr>\n
SHOW tables;<\/td>\n\u663e\u793a\u5f53\u524d\u6570\u636e\u5e93\u4e2d\u7684\u8868\u5355<\/td>\n<\/tr>\n
SELECT * FROM \u8868\u5355\u540d\u79f0;<\/td>\n\u4ece\u8868\u5355\u4e2d\u9009\u4e2d\u67d0\u4e2a\u8bb0\u5f55\u503c<\/td>\n<\/tr>\n
DELETE FROM \u8868\u5355\u540d WHERE attribute=\u503c;<\/td>\n\u4ece\u8868\u5355\u4e2d\u5220\u9664\u67d0\u4e2a\u8bb0\u5f55\u503c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

<\/p>\n

\u5efa\u7acb\u6570\u636e\u5e93\u662f\u7ba1\u7406\u6570\u636e\u7684\u8d77\u70b9\u3002\u73b0\u5728\u5c1d\u8bd5\u521b\u5efa\u4e00\u4e2a\u540d\u4e3alinuxprobe\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u518d\u67e5\u770b\u6570\u636e\u5e93\u5217\u8868\uff0c\u6b64\u65f6\u5c31\u80fd\u770b\u5230\u5b83\u4e86\uff1a<\/p>\n

MariaDB [(none)]>  CREATE DATABASE linuxprobe;\r\nQuery OK, 1 row affected (0.001 sec)\r\n\r\nMariaDB [(none)]>  SHOW databases;\r\n+--------------------+\r\n| Database           |\r\n+--------------------+\r\n| information_schema |\r\n| linuxprobe         |\r\n| mysql              |\r\n| performance_schema |\r\n+--------------------+\r\n4 rows in set (0.001 sec)\r\n<\/pre>\n

MariaDB\u4e0eMySQL\u540c\u5c5e\u4e8e\u5173\u7cfb\u578b\u6570\u636e\u5e93\uff08Relational Database Management System\uff0cRDBMS\uff09\u3002\u5173\u7cfb\u578b\u6570\u636e\u5e93\u6709\u4e9b\u7c7b\u4f3c\u4e8e\u8868\u683c\u7684\u6982\u5ff5\uff0c\u4e00\u4e2a\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7531\u4e00\u4e2a\u6216\u591a\u4e2a\u8868\u683c\/\u8868\u5355\u7ec4\u6210\uff0c\u5982\u56fe18-2\u6240\u793a\u3002<\/p>\n

\u5728\u56fe18-2\u4e2d\uff0c\u8868\u5934\u8868\u793a\u6bcf\u4e00\u5217\u7684\u540d\u79f0\uff1b\u5217\u8868\u793a\u5177\u6709\u76f8\u540c\u6570\u636e\u7c7b\u578b\u7684\u6570\u636e\u96c6\u5408\uff1b\u884c\u8868\u793a\u7528\u6765\u63cf\u8ff0\u4e8b\u7269\u7684\u5177\u4f53\u4fe1\u606f\uff1b\u503c\u8868\u793a\u884c\u7684\u5177\u4f53\u4fe1\u606f\uff0c\u6bcf\u4e2a\u503c\u5747\u4e0e\u8be5\u5217\u7684\u5176\u4ed6\u6570\u636e\u7c7b\u578b\u76f8\u540c\uff1b\u952e\u8868\u793a\u7528\u6765\u8bc6\u522b\u67d0\u4e2a\u7279\u5b9a\u4e8b\u7269\u7684\u65b9\u6cd5\uff0c\u5728\u5f53\u524d\u5217\u4e2d\u5177\u6709\u552f\u4e00\u6027\u3002<\/p>\n

\"\"<\/p>\n

\u56fe18-2 \u6570\u636e\u5e93\u5b58\u50a8\u6982\u5ff5<\/p>\n

\u6bd4\u5982\uff0c\u5728\u65b0\u5efa\u7684linuxprobe\u6570\u636e\u5e93\u4e2d\u521b\u5efa\u8868\u5355mybook\uff0c\u7136\u540e\u8fdb\u884c\u8868\u5355\u7684\u521d\u59cb\u5316\uff0c\u5373\u5b9a\u4e49\u5b58\u50a8\u6570\u636e\u5185\u5bb9\u7684\u7ed3\u6784\u3002\u6211\u4eec\u5206\u522b\u5b9a\u4e493\u4e2a\u5b57\u6bb5\u9879\uff0c\u5176\u4e2d\uff0c\u5b57\u7b26\u578b\u5b57\u6bb5name\uff08\u957f\u5ea6\u4e3a15\u5b57\u7b26\uff09\u7528\u6765\u5b58\u653e\u56fe\u4e66\u540d\u79f0\uff0c\u6574\u578b\u5b57\u6bb5price\u548cpages\u5206\u522b\u5b58\u50a8\u56fe\u4e66\u7684\u4ef7\u683c\u548c\u9875\u6570\u3002\u5f53\u6267\u884c\u5b8c\u4e0b\u8ff0\u547d\u4ee4\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u770b\u5230\u8868\u5355\u7684\u7ed3\u6784\u4fe1\u606f\u4e86\uff1a<\/p>\n

MariaDB [(none)]> use linuxprobe;\r\nDatabase changed\r\nMariaDB [linuxprobe]> CREATE TABLE mybook (name char(15),price int,pages int);\r\nQuery OK, 0 rows affected (0.009 sec)\r\n\r\nMariaDB [linuxprobe]> DESCRIBE mybook;\r\n+-------+----------+------+-----+---------+-------+\r\n| Field | Type     | Null | Key | Default | Extra |\r\n+-------+----------+------+-----+---------+-------+\r\n| name  | char(15) | YES  |     | NULL    |       |\r\n| price | int(11)  | YES  |     | NULL    |       |\r\n| pages | int(11)  | YES  |     | NULL    |       |\r\n+-------+----------+------+-----+---------+-------+\r\n3 rows in set (0.002 sec)\r\n<\/pre>\n
18.5 \u7ba1\u7406\u8868\u5355\u53ca\u6570\u636e<\/span><\/strong><\/h5>\n

\u63a5\u4e0b\u6765\u5411mybook\u6570\u636e\u8868\u5355\u4e2d\u63d2\u5165\u4e00\u6761\u56fe\u4e66\u4fe1\u606f\u3002\u4e3a\u6b64\u9700\u8981\u4f7f\u7528INSERT\u547d\u4ee4\uff0c\u5e76\u5728\u547d\u4ee4\u4e2d\u5199\u6e05\u8868\u5355\u540d\u79f0\u4ee5\u53ca\u5bf9\u5e94\u7684\u5b57\u6bb5\u9879\u3002\u6267\u884c\u8be5\u547d\u4ee4\u4e4b\u540e\u5373\u53ef\u5b8c\u6210\u56fe\u4e66\u5199\u5165\u4fe1\u606f\u3002\u4e0b\u9762\u4f7f\u7528\u8be5\u547d\u4ee4\u63d2\u5165\u4e00\u6761\u56fe\u4e66\u4fe1\u606f\uff0c\u5176\u4e2d\u4e66\u540d\u4e3alinuxprobe\uff0c\u4ef7\u683c\u548c\u9875\u6570\u5206\u522b\u662f60\u5143\u548c518\u9875\u3002\u5728\u547d\u4ee4\u6267\u884c\u540e\u4e5f\u5c31\u610f\u5473\u7740\u56fe\u4e66\u4fe1\u606f\u5df2\u7ecf\u6210\u529f\u5199\u5165\u5230\u6570\u636e\u8868\u5355\u4e2d\uff0c\u7136\u540e\u5c31\u53ef\u4ee5\u67e5\u8be2\u8868\u5355\u4e2d\u7684\u5185\u5bb9\u4e86\u3002\u5728\u4f7f\u7528SELECT\u547d\u4ee4\u67e5\u8be2\u8868\u5355\u5185\u5bb9\u65f6\uff0c\u9700\u8981\u52a0\u4e0a\u60f3\u8981\u67e5\u8be2\u7684\u5b57\u6bb5\uff1b\u5982\u679c\u60f3\u67e5\u770b\u8868\u5355\u4e2d\u7684\u6240\u6709\u5185\u5bb9\uff0c\u5219\u4f7f\u7528\u661f\u53f7\uff08*\uff09\u901a\u914d\u7b26\u6765\u663e\u793a\uff1a<\/p>\n

MariaDB [linuxprobe]> INSERT INTO mybook(name,price,pages) VALUES('linuxprobe','60', '518');\r\nQuery OK, 1 row affected (0.001 sec)\r\n\r\nMariaDB [linuxprobe]> SELECT * from mybook;\r\n+------------+-------+-------+\r\n| name       | price | pages |\r\n+------------+-------+-------+\r\n| linuxprobe |    60 |   518 |\r\n+------------+-------+-------+\r\n1 row in set (0.000 sec)\r\n<\/pre>\n

\u5bf9\u6570\u636e\u5e93\u8fd0\u7ef4\u4eba\u5458\u6765\u8bb2\uff0c\u9700\u8981\u505a\u597d\u56db\u95e8\u529f\u8bfe\u2014\u589e\u3001\u5220\u3001\u6539\u3001\u67e5\u3002\u8fd9\u610f\u5473\u7740\u521b\u5efa\u6570\u636e\u8868\u5355\u5e76\u5728\u5176\u4e2d\u63d2\u5165\u5185\u5bb9\u4ec5\u4ec5\u662f\u7b2c\u4e00\u6b65\uff0c\u8fd8\u9700\u8981\u638c\u63e1\u6570\u636e\u8868\u5355\u5185\u5bb9\u7684\u4fee\u6539\u65b9\u6cd5\u3002\u4f8b\u5982\uff0c\u53ef\u4ee5\u4f7f\u7528UPDATE\u547d\u4ee4\u5c06\u521a\u624d\u63d2\u5165\u7684linuxprobe\u56fe\u4e66\u4fe1\u606f\u7684\u4ef7\u683c\u4fee\u6539\u4e3a55\u5143\uff0c\u7136\u540e\u518d\u4f7f\u7528SELECT\u547d\u4ee4\u67e5\u770b\u8be5\u56fe\u4e66\u7684\u540d\u79f0\u548c\u5b9a\u4ef7\u4fe1\u606f\u3002\u6ce8\u610f\uff0c\u56e0\u4e3a\u8fd9\u91cc\u53ea\u67e5\u770b\u56fe\u4e66\u7684\u540d\u79f0\u548c\u5b9a\u4ef7\uff0c\u800c\u4e0d\u6d89\u53ca\u9875\u7801\uff0c\u6240\u4ee5\u65e0\u987b\u518d\u7528\u661f\u53f7\u901a\u914d\u7b26\u6765\u663e\u793a\u6240\u6709\u5185\u5bb9\u3002<\/p>\n

MariaDB [linuxprobe]> UPDATE mybook SET price=55 ;\r\nQuery OK, 1 row affected (0.002 sec)\r\nRows matched: 1  Changed: 1  Warnings: 0\r\n\r\nMariaDB [linuxprobe]> SELECT name,price FROM mybook;\r\n+------------+-------+\r\n| name       | price |\r\n+------------+-------+\r\n| linuxprobe |    55 |\r\n+------------+-------+\r\n1 row in set (0.000 sec)\r\n<\/pre>\n

\u60f3\u4fee\u6539\u6307\u5b9a\u7684\u67d0\u4e00\u6761\u8bb0\u5f55\uff1f\u6ca1\u95ee\u9898\u7684\uff0c\u7528WHERE\u547d\u4ee4\u8fdb\u884c\u9650\u5b9a\u5373\u53ef\u3002\u6211\u4eec\u5148\u63d2\u5165\u4e24\u6761\u56fe\u4e66\u4fe1\u606f\uff1a<\/p>\n

MariaDB [linuxprobe]> INSERT INTO mybook(name,price,pages) VALUES('linuxcool','85', '300');\r\nQuery OK, 1 row affected (0.001 sec)\r\nMariaDB [linuxprobe]> INSERT INTO mybook(name,price,pages) VALUES('linuxdown','105', '500');\r\nQuery OK, 1 row affected (0.001 sec)<\/pre>\n

\u7136\u540e\u4f7f\u7528WHERE\u547d\u4ee4\u4ec5\u5c06\u540d\u79f0\u4e3alinuxcool\u7684\u56fe\u4e66\u4ef7\u683c\u4fee\u6539\u4e3a60\u5143\uff0c\u4e0d\u5f71\u54cd\u5176\u4ed6\u56fe\u4e66\u4fe1\u606f\uff1a<\/p>\n

MariaDB [linuxprobe]> UPDATE mybook SET price=60 where name='linuxcool';\r\nQuery OK, 1 row affected (0.001 sec)\r\nRows matched: 1  Changed: 1  Warnings: 0\r\n\r\nMariaDB [linuxprobe]> select * from mybook;\r\n+------------+-------+-------+\r\n| name       | price | pages |\r\n+------------+-------+-------+\r\n| linuxprobe |    55 |   518 |\r\n| linuxcool  |    60 |   300 |\r\n| linuxdown  |   105 |   500 |\r\n+------------+-------+-------+\r\n3 rows in set (0.001 sec)\r\n<\/pre>\n

\u8fd8\u53ef\u4ee5\u4f7f\u7528DELETE\u547d\u4ee4\u5220\u9664\u67d0\u4e2a\u6570\u636e\u8868\u5355\u4e2d\u7684\u5185\u5bb9\u3002\u4e0b\u9762\u4f7f\u7528DELETE\u547d\u4ee4\u5220\u9664\u6570\u636e\u8868\u5355mybook\u4e2d\u7684\u6240\u6709\u5185\u5bb9\uff0c\u7136\u540e\u518d\u67e5\u770b\u8be5\u8868\u5355\u4e2d\u7684\u5185\u5bb9\uff0c\u5c31\u4f1a\u53d1\u73b0\u8be5\u8868\u5355\u5185\u5bb9\u4e3a\u7a7a\u4e86\uff1a<\/p>\n

MariaDB [linuxprobe]> DELETE FROM mybook;\r\nQuery OK, 3 row affected (0.001 sec)\r\n\r\nMariaDB [linuxprobe]> SELECT * FROM mybook;\r\nEmpty set (0.000 sec)\r\n<\/pre>\n

\u4e00\u822c\u6765\u8bb2\uff0c\u6570\u636e\u8868\u5355\u4e2d\u4f1a\u5b58\u653e\u6210\u5343\u4e0a\u4e07\u6761\u6570\u636e\u4fe1\u606f\u3002\u6bd4\u5982\u6211\u4eec\u521a\u521a\u521b\u5efa\u7684\u7528\u4e8e\u4fdd\u5b58\u56fe\u4e66\u4fe1\u606f\u7684mybook\u8868\u5355\uff0c\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\uff0c\u91cc\u9762\u7684\u56fe\u4e66\u4fe1\u606f\u4e5f\u4f1a\u8d8a\u6765\u8d8a\u591a\u3002\u5728\u8fd9\u6837\u7684\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u53ea\u60f3\u67e5\u770b\u5176\u4ef7\u683c\u5927\u4e8e\u67d0\u4e2a\u6570\u503c\u7684\u56fe\u4e66\uff0c\u53c8\u8be5\u5982\u4f55\u5b9a\u4e49\u67e5\u8be2\u8bed\u53e5\u5462\uff1f<\/p>\n

\u4e0b\u9762\u5148\u4f7f\u7528INSERT\u63d2\u5165\u547d\u4ee4\u4f9d\u6b21\u63d2\u51654\u6761\u56fe\u4e66\u4fe1\u606f\uff1a<\/p>\n

MariaDB [linuxprobe]> INSERT INTO mybook(name,price,pages) VALUES('linuxprobe1','30<\/span>','518');<\/strong>\r\nQuery OK, 1 row affected (0.05 sec)\r\nMariaDB [linuxprobe]> INSERT INTO mybook(name,price,pages) VALUES('linuxprobe2','50<\/span>','518');<\/strong>\r\nQuery OK, 1 row affected (0.05 sec)\r\nMariaDB [linuxprobe]> INSERT INTO mybook(name,price,pages) VALUES('linuxprobe3','80<\/span>','518');<\/strong>\r\nQuery OK, 1 row affected (0.01 sec)\r\nMariaDB [linuxprobe]> INSERT INTO mybook(name,price,pages) VALUES('linuxprobe4','100<\/span>','518');<\/strong>\r\nQuery OK, 1 row affected (0.00 sec)\r\n<\/pre>\n

\u8981\u60f3\u8ba9\u67e5\u8be2\u7ed3\u679c\u66f4\u52a0\u7cbe\u51c6\uff0c\u5c31\u9700\u8981\u7ed3\u5408\u4f7f\u7528SELECT\u4e0eWHERE\u547d\u4ee4\u4e86\u3002\u5176\u4e2d\uff0cWHERE\u547d\u4ee4\u662f\u5728\u6570\u636e\u5e93\u4e2d\u8fdb\u884c\u5339\u914d\u67e5\u8be2\u7684\u6761\u4ef6\u547d\u4ee4\u3002\u901a\u8fc7\u8bbe\u7f6e\u67e5\u8be2\u6761\u4ef6\uff0c\u80fd\u591f\u4ec5\u67e5\u627e\u51fa\u7b26\u5408\u8be5\u6761\u4ef6\u7684\u6570\u636e\u3002\u886818-3\u5217\u51fa\u4e86WHERE\u547d\u4ee4\u4e2d\u5e38\u7528\u7684\u67e5\u8be2\u53c2\u6570\u4ee5\u53ca\u4f5c\u7528\u3002<\/p>\n

\u886818-3\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 where\u547d\u4ee4\u4e2d\u4f7f\u7528\u7684\u53c2\u6570\u4ee5\u53ca\u4f5c\u7528<\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n
\u53c2\u6570<\/td>\n\u4f5c\u7528<\/td>\n<\/tr>\n
=<\/td>\n\u76f8\u7b49<\/td>\n<\/tr>\n
<>\u6216!=<\/td>\n\u4e0d\u76f8\u7b49<\/td>\n<\/tr>\n
><\/td>\n\u5927\u4e8e<\/td>\n<\/tr>\n
<<\/td>\n\u5c0f\u4e8e<\/td>\n<\/tr>\n
>=<\/td>\n\u5927\u4e8e\u6216\u7b49\u4e8e<\/td>\n<\/tr>\n
<=<\/td>\n\u5c0f\u4e8e\u6216\u7b49\u4e8e<\/td>\n<\/tr>\n
BETWEEN<\/td>\n\u5728\u67d0\u4e2a\u8303\u56f4\u5185<\/td>\n<\/tr>\n
LIKE<\/td>\n\u641c\u7d22\u4e00\u4e2a\u4f8b\u5b50<\/td>\n<\/tr>\n
IN<\/td>\n\u5728\u5217\u4e2d\u641c\u7d22\u591a\u4e2a\u503c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

<\/p>\n

\u73b0\u5728\u8fdb\u5165\u52a8\u624b\u73af\u8282\u3002\u5206\u522b\u5728mybook\u8868\u5355\u4e2d\u67e5\u627e\u51fa\u4ef7\u683c\u5927\u4e8e75\u5143\u6216\u4ef7\u683c\u4e0d\u7b49\u4e8e80\u5143\u7684\u56fe\u4e66\uff0c\u5176\u5bf9\u5e94\u7684\u547d\u4ee4\u5982\u4e0b\u6240\u793a\u3002\u5728\u719f\u6089\u4e86\u8fd9\u4e24\u4e2a\u67e5\u8be2\u6761\u4ef6\u4e4b\u540e\uff0c\u5927\u5bb6\u53ef\u4ee5\u81ea\u884c\u5c1d\u8bd5\u7cbe\u786e\u67e5\u627e\u56fe\u4e66\u540d\u4e3alinuxprobe2\u7684\u56fe\u4e66\u4fe1\u606f\u3002<\/p>\n

MariaDB [linuxprobe]> SELECT * FROM mybook WHERE price>75;\r\n+-------------+-------+-------+\r\n| name        | price | pages |\r\n+-------------+-------+-------+\r\n| linuxprobe3 |    80 |   518 |\r\n| linuxprobe4 |   100 |   518 |\r\n+-------------+-------+-------+\r\n2 rows in set (0.001 sec)\r\n\r\nMariaDB [linuxprobe]> SELECT * FROM mybook WHERE price!=80;\r\n+-------------+-------+-------+\r\n| name        | price | pages |\r\n+-------------+-------+-------+\r\n| linuxprobe1 |    30 |   518 |\r\n| linuxprobe2 |    50 |   518 |\r\n| linuxprobe4 |   100 |   518 |\r\n+-------------+-------+-------+\r\n3 rows in set (0.000 sec)<\/pre>\n

\u5339\u914d\u7684\u6761\u4ef6\u8d8a\u591a\uff0c\u83b7\u5f97\u7684\u4fe1\u606f\u5c31\u8d8a\u7cbe\u51c6\u3002\u53ef\u4ee5\u5728WHERE\u547d\u4ee4\u7684\u540e\u9762\u8ffd\u52a0AND\u64cd\u4f5c\u7b26\uff0c\u8fdb\u884c\u591a\u6b21\u5339\u914d\u3002\u4f8b\u5982\uff0c\u6267\u884c\u4e0b\u8ff0\u547d\u4ee4\uff0c\u627e\u5230\u4ef7\u683c\u4e3a30\u5143\u3001\u9875\u6570\u4e3a518\u7684\u56fe\u4e66\u7684\u540d\u79f0\uff1a<\/p>\n

MariaDB [linuxprobe]> SELECT * from mybook WHERE price=30 AND pages=518 ;\r\n+-------------+-------+-------+\r\n| name        | price | pages |\r\n+-------------+-------+-------+\r\n| linuxprobe1 |    30 |   518 |\r\n+-------------+-------+-------+\r\n1 row in set (0.000 sec)\r\n<\/pre>\n
18.6 \u6570\u636e\u5e93\u7684\u5907\u4efd\u53ca\u6062\u590d<\/span><\/strong><\/h5>\n

\u524d\u6587\u63d0\u5230\uff0c\u672c\u4e66\u7684\u6280\u672f\u4e3b\u7ebf\u662fLinux\u7cfb\u7edf\u7684\u8fd0\u7ef4\u65b9\u5411\uff0c\u4e0d\u4f1a\u5bf9\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u7684\u64cd\u4f5c\u8fdb\u884c\u6df1\u5165\u7684\u8bb2\u89e3\uff0c\u56e0\u6b64\u5927\u5bb6\u638c\u63e1\u4e86\u4e0a\u9762\u8fd9\u4e9b\u57fa\u672c\u7684\u6570\u636e\u5e93\u64cd\u4f5c\u547d\u4ee4\u4e4b\u540e\u5c31\u8db3\u591f\u4e86\u3002\u4e0b\u9762\u8981\u8bb2\u89e3\u7684\u662f\u6570\u636e\u5e93\u7684\u5907\u4efd\u4ee5\u53ca\u6062\u590d\uff0c\u8fd9\u4e9b\u77e5\u8bc6\u6bd4\u8f83\u5b9e\u7528\uff0c\u5e0c\u671b\u5927\u5bb6\u80fd\u591f\u638c\u63e1\u3002<\/p>\n

mysqldump\u547d\u4ee4\u7528\u4e8e\u5907\u4efd\u6570\u636e\u5e93\u6570\u636e\uff0c\u683c\u5f0f\u4e3a\u201cmysqldump [\u53c2\u6570] [\u6570\u636e\u5e93\u540d\u79f0]\u201d\u3002\u5176\u4e2d\u53c2\u6570\u4e0emysql\u547d\u4ee4\u5927\u81f4\u76f8\u540c\uff0c-u\u53c2\u6570\u7528\u4e8e\u5b9a\u4e49\u767b\u5f55\u6570\u636e\u5e93\u7684\u7528\u6237\u540d\u79f0\uff0c-p\u53c2\u6570\u8868\u793a\u5bc6\u7801\u63d0\u793a\u7b26\u3002\u4e0b\u9762\u5c06linuxprobe\u6570\u636e\u5e93\u4e2d\u7684\u5185\u5bb9\u5bfc\u51fa\u4e3a\u4e00\u4e2a\u6587\u4ef6\uff0c\u5e76\u4fdd\u5b58\u5230root\u7ba1\u7406\u5458\u7684\u5bb6\u76ee\u5f55\u4e2d\uff1a<\/p>\n

[root@linuxprobe ~]# mysqldump -u root -p linuxprobe > \/root\/linuxprobeDB.dump\r\nEnter password: \u8f93\u5165\u7ba1\u7406\u5458\u7684\u6570\u636e\u5e93\u5bc6\u7801<\/strong>\r\n<\/pre>\n

\u7136\u540e\u8fdb\u5165MariaDB\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u5f7b\u5e95\u5220\u9664linuxprobe\u6570\u636e\u5e93\uff0c\u8fd9\u6837mybook\u6570\u636e\u8868\u5355\u4e5f\u5c06\u88ab\u5f7b\u5e95\u5220\u9664\u3002\u7136\u540e\u91cd\u65b0\u5efa\u7acblinuxprobe\u6570\u636e\u5e93\uff1a<\/p>\n

[root@linuxprobe ~]# mysql -u root -p\r\nEnter password: \u8f93\u5165\u7ba1\u7406\u5458\u7684\u6570\u636e\u5e93\u5bc6\u7801<\/strong>\r\n\r\nMariaDB [(none)]> DROP\u00a0DATABASE\u00a0linuxprobe;\r\nQuery OK, 1 row affected (0.04 sec)\r\n\r\nMariaDB [(none)]> SHOW\u00a0databases;\r\n+--------------------+\r\n| Database           |\r\n+--------------------+\r\n| information_schema |\r\n| mysql              |\r\n| performance_schema |\r\n+--------------------+\r\n3 rows in set (0.02 sec)\r\n\r\nMariaDB [(none)]> CREATE\u00a0DATABASE\u00a0linuxprobe;\r\nQuery OK, 1 row affected (0.00 sec)<\/pre>\n

\u63a5\u4e0b\u6765\u662f\u89c1\u8bc1\u6570\u636e\u6062\u590d\u6548\u679c\u7684\u65f6\u523b\uff01\u4f7f\u7528\u8f93\u5165\u91cd\u5b9a\u5411\u7b26\u628a\u521a\u521a\u5907\u4efd\u7684\u6570\u636e\u5e93\u6587\u4ef6\u5bfc\u5165\u5230mysql\u547d\u4ee4\u4e2d\uff0c\u7136\u540e\u6267\u884c\u8be5\u547d\u4ee4\u3002\u63a5\u4e0b\u6765\u767b\u5f55MariaDB\u6570\u636e\u5e93\uff0c\u5c31\u53c8\u80fd\u770b\u5230linuxprobe\u6570\u636e\u5e93\u4ee5\u53camybook\u6570\u636e\u8868\u5355\u4e86\u3002\u6570\u636e\u5e93\u6062\u590d\u6210\u529f\uff01<\/p>\n

[root@linuxprobe ~]# mysql -u root -p linuxprobe < \/root\/linuxprobeDB.dump \r\nEnter password: \u8f93\u5165\u7ba1\u7406\u5458\u7684\u6570\u636e\u5e93\u5bc6\u7801<\/strong>\r\n[root@linuxprobe ~]# mysql -u root -p\r\nEnter password: \u8f93\u5165\u7ba1\u7406\u5458\u7684\u6570\u636e\u5e93\u5bc6\u7801<\/strong>\r\nMariaDB [(none)]> use linuxprobe;\r\nDatabase changed\r\n\r\nMariaDB [linuxprobe]> SHOW tables;\r\n+----------------------+\r\n| Tables_in_linuxprobe |\r\n+----------------------+\r\n| mybook               |\r\n+----------------------+\r\n1 row in set (0.000 sec)\r\n\r\nMariaDB [linuxprobe]> describe mybook;\r\n+-------+----------+------+-----+---------+-------+\r\n| Field | Type     | Null | Key | Default | Extra |\r\n+-------+----------+------+-----+---------+-------+\r\n| name  | char(15) | YES  |     | NULL    |       |\r\n| price | int(11)  | YES  |     | NULL    |       |\r\n| pages | int(11)  | YES  |     | NULL    |       |\r\n+-------+----------+------+-----+---------+-------+\r\n3 rows in set (0.002 sec)\r\n<\/pre>\n

\u51fa\u73b0\u95ee\u9898?\u5927\u80c6\u63d0\u95ee!<\/strong><\/span><\/p>\n

\u56e0\u8bfb\u8005\u4eec\u786c\u4ef6\u4e0d\u540c\u6216\u64cd\u4f5c\u9519\u8bef\u90fd\u53ef\u80fd\u5bfc\u81f4\u5b9e\u9a8c\u914d\u7f6e\u51fa\u9519\uff0c\u8bf7\u8010\u5fc3\u518d\u4ed4\u7ec6\u770b\u770b\u64cd\u4f5c\u6b65\u9aa4\u5427\uff0c\u4e0d\u8981\u6c14\u9981~<\/p>\n

Linux\u6280\u672f\u4ea4\u6d41\u5b66\u4e60\u8bf7\u52a0\u8bfb\u8005\u7fa4\uff08\u63a8\u8350<\/span><\/strong>\uff09\uff1ahttps:\/\/lrxjmw.cn\/club<\/a><\/p>\n

*\u672c\u7fa4\u7279\u8272\uff1a\u786e\u4fdd\u6bcf\u4e00\u4f4d\u7fa4\u53cb\u90fd\u662f\u300aLinux\u5c31\u8be5\u8fd9\u4e48\u5b66\u300b\u7684\u8bfb\u8005\uff0c\u7b54\u7591\u66f4\u6709\u9488\u5bf9\u6027\uff0c\u4e0d\u5b9a\u671f\u9886\u53d6\u5b9a\u5236\u793c\u54c1\u3002<\/p><\/blockquote>\n

\u672c\u7ae0\u8282\u7684\u590d\u4e60\u4f5c\u4e1a<\/span>(\u7b54\u6848\u5c31\u5728\u95ee\u9898\u7684\u4e0b\u4e00\u884c\u54e6\uff0c\u7528\u9f20\u6807\u9009\u4e2d\u5373\u53ef\u770b\u5230\u7684~)<\/span><\/strong><\/p>\n

1\uff0eRHEL\u7cfb\u7edf\u4e3a\u4f55\u9009\u62e9\u4f7f\u7528MariaDB\u66ff\u4ee3MySQL\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff1f<\/p>\n

\u7b54\uff1a<\/strong>\u56e0\u4e3aMariaDB\u7531\u5f00\u6e90\u793e\u533a\u8fdb\u884c\u7ef4\u62a4\uff0c\u4e14\u4e0d\u53d7\u5546\u4e1a\u4e13\u5229\u9650\u5236\u3002<\/span><\/p>\n

2\uff0e\u521d\u59cb\u5316MariaDB\u6216MySQL\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u7684\u547d\u4ee4\u662f\u4ec0\u4e48\uff1f<\/p>\n

\u7b54\uff1a<\/strong>\u662fmysql_secure_installation\u547d\u4ee4\uff0c\u5efa\u8bae\u6bcf\u6b21\u5b89\u88c5MariaDB\u6216MySQL\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\u540e\u90fd\u6267\u884c\u8fd9\u6761\u547d\u4ee4\u3002<\/span><\/p>\n

3\uff0e\u7528\u6765\u67e5\u770b\u5df2\u6709\u6570\u636e\u5e93\u6216\u6570\u636e\u8868\u5355\u7684\u547d\u4ee4\u662f\u4ec0\u4e48\uff1f<\/p>\n

\u7b54\uff1a<\/strong>\u8981\u67e5\u770b\u5f53\u524d\u5df2\u6709\u7684\u6570\u636e\u5e93\u5217\u8868\uff0c\u9700\u6267\u884cSHOW databases;\u547d\u4ee4\uff1b\u8981\u67e5\u770b\u5df2\u6709\u7684\u6570\u636e\u8868\u5355\u5217\u8868\uff0c\u5219\u9700\u6267\u884cSHOW tables;\u547d\u4ee4\u3002<\/span><\/p>\n

4\uff0e\u5207\u6362\u81f3\u67d0\u4e2a\u6307\u5b9a\u6570\u636e\u5e93\u7684\u547d\u4ee4\u662f\u4ec0\u4e48\uff1f<\/p>\n

\u7b54\uff1a<\/strong>\u6267\u884c\u201cuse\u6570\u636e\u5e93\u540d\u79f0\u201d\u547d\u4ee4\u5373\u53ef\u5207\u6362\u6210\u529f\u3002<\/span><\/p>\n

5\uff0e\u82e5\u60f3\u9488\u5bf9\u67d0\u4e2a\u7528\u6237\u8fdb\u884c\u6388\u6743\u6216\u53d6\u6d88\u6388\u6743\u64cd\u4f5c\uff0c\u5e94\u8be5\u6267\u884c\u4ec0\u4e48\u547d\u4ee4\uff1f<\/p>\n

\u7b54\uff1a<\/strong>\u9488\u5bf9\u7528\u6237\u8fdb\u884c\u6388\u6743\uff0c\u9700\u6267\u884cGRANT\u547d\u4ee4\uff1b\u53d6\u6d88\u6388\u6743\u5219\u9700\u6267\u884cREVOKE\u547d\u4ee4\u3002<\/span><\/p>\n

6\uff0e\u82e5\u60f3\u5220\u9664\u4e00\u4e2a\u53ebluke\u7684\u672c\u5730\u6570\u636e\u5e93\u8d26\u6237\uff0c\u5e94\u8be5\u6267\u884c\u4ec0\u4e48\u547d\u4ee4\uff1f<\/p>\n

\u7b54\uff1a<\/strong>\u5e94\u6267\u884cDROP user luke@localhost;\u547d\u4ee4\u3002 <\/span><\/p>\n

7\uff0e\u82e5\u53ea\u60f3\u67e5\u770bmybook\u8868\u5355\u4e2d\u7684name\u5b57\u6bb5\uff0c\u5e94\u8be5\u6267\u884c\u4ec0\u4e48\u547d\u4ee4\uff1f<\/p>\n

\u7b54\uff1a<\/strong>\u5e94\u6267\u884cSELECT name FROM mybook\u547d\u4ee4\u3002<\/span><\/p>\n

8\uff0e\u82e5\u53ea\u60f3\u67e5\u770bmybook\u8868\u5355\u4e2d\u4ef7\u683c\u5927\u4e8e75\u5143\u7684\u56fe\u4e66\u4fe1\u606f\uff0c\u5e94\u8be5\u6267\u884c\u4ec0\u4e48\u547d\u4ee4\uff1f<\/p>\n

\u7b54\uff1a<\/strong>\u5e94\u6267\u884cSELECT * FROM mybook WHERE price>75\u547d\u4ee4\u3002<\/span><\/p>\n

9\uff0e\u8981\u60f3\u628alinuxprobe\u6570\u636e\u5e93\u4e2d\u7684\u5185\u5bb9\u5bfc\u51fa\u4e3a\u5907\u4efd\u6587\u4ef6\uff08\u4fdd\u5b58\u5230root\u7ba1\u7406\u5458\u7684\u5bb6\u76ee\u5f55\u4e2d\uff09\uff0c\u5e94\u8be5\u6267\u884c\u4ec0\u4e48\u547d\u4ee4\uff1f<\/p>\n

\u7b54\uff1a<\/strong>\u5e94\u6267\u884cmysqldump -u root -p linuxprobe > \/root\/linuxprobeDB.dump\u547d\u4ee4\u3002<\/span><\/p>\n

10\uff0e\u8981\u60f3\u5c06\u4e0a\u8ff0\u5907\u4efd\u6587\u4ef6\u6062\u590d\u5230\u6570\u636e\u5e93\u4e2d\uff0c\u5e94\u8be5\u6267\u884c\u4ec0\u4e48\u547d\u4ee4\uff1f<\/p>\n

\u7b54\uff1a<\/strong>\u5e94\u6267\u884cmysql -u root -p linuxprobe < \/root\/linuxprobeDB.dump\u547d\u4ee4\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"

\u7ae0\u8282\u7b80\u8ff0\uff1a \u81ea\u4eceMySQL\u6570\u636e\u5e93\u9879\u76ee\u88abOracle\u516c\u53f8\u6536\u8d2d\u540e\uff0c\u5176\u4ece\u5f00\u6e90\u8f6f\u4ef6\u9010\u6e10\u8f6c\u53d8\u4e3a\u201c\u95ed\u6e90\u201d\u8f6f\u4ef6\uff0c\u8fd9\u4e00\u53d8\u5316\u4fc3\u4f7f […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2632,4],"tags":[],"class_list":["post-291371","post","type-post","status-publish","format-standard","hentry","category-rhel10","category-chapter"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/291371","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=291371"}],"version-history":[{"count":8,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/291371\/revisions"}],"predecessor-version":[{"id":292632,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/291371\/revisions\/292632"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=291371"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=291371"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=291371"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}