{"id":123,"date":"2015-05-04T17:54:26","date_gmt":"2015-05-04T17:54:26","guid":{"rendered":""},"modified":"2015-05-04T17:54:26","modified_gmt":"2015-05-04T17:54:26","slug":"","status":"publish","type":"post","link":"http:\/\/weizn.net\/?p=123","title":{"rendered":"[\u8f6c]linux\u5b89\u88c5mysql\u548c\u4f7f\u7528c\u8bed\u8a00\u64cd\u4f5c\u6570\u636e\u5e93\u7684\u65b9\u6cd5"},"content":{"rendered":"<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t1. MySQL\u7684\u5b89\u88c5\u4e0e\u914d\u7f6e\uff1a\n<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u5728Ubuntu\u4e0b\u5b89\u88c5MySQL\u65b9\u6cd5\u5f88\u7b80\u5355\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut84766\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code84766\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\nsudo apt-get install mysql-server\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u5b89\u88c5\u7684\u8fc7\u7a0b\u4e2d\u7cfb\u7edf\u4f1a\u63d0\u793a\u8bbe\u7f6eroot\u5bc6\u7801\uff0c\u6b64\u8fc7\u7a0b\u53ef\u4ee5\u8df3\u8fc7\uff0c\u4f46\u662f\u5efa\u8bae\u5728\u5b89\u88c5\u65f6\u63d0\u793a\u8bbe\u7f6eroot\u5bc6\u7801\u7684\u65f6\u5019\u81ea\u884c\u8bbe\u7f6e\uff0c\u514d\u5f97\u540e\u9762\u8bbe\u7f6e\u9ebb\u70e6\u3002\u5b89\u88c5\u7ed3\u675f\u4e4b\u540e\uff0c\u7cfb\u7edf\u4f1a\u542f\u52a8mysql\u670d\u52a1\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u53bb\u67e5\u770b\u6765\u9a8c\u8bc1mysql\u670d\u52a1\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u6210\u529f\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut76480\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code76480\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\nps -el | grep mysql\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u5982\u679cmysql\u670d\u52a1\u6ca1\u6709\u6b63\u5e38\u7684\u8fd0\u884c\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u6307\u4ee4\u5bf9mysql\u670d\u52a1\u8fdb\u884c\u91cd\u542f\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut54454\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code54454\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\nsudo service mysql restart\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u559c\u6b22\u4f7f\u7528Workbench\u754c\u9762\u7684\uff0c\u8fd8\u9700\u8981\u5b89\u88c5Workbench\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut93975\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code93975\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\nsudo apt-get install mysql-workbench\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\tWorkbench\u7684\u542f\u52a8\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut75412\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code75412\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\nmysql-workbench &#8211;log-level=debug3 &#8211;verbose\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t2. MySQL\u547d\u4ee4\u884c\uff1a\n<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u6211\u4eec\u4f7f\u7528root\u53bb\u767b\u5f55MySQL\uff0c\u7136\u540e\u505a\u76f8\u5173\u7684\u64cd\u4f5c\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut57658\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code57658\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\nmysql -u root -p\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u5728\u6b64\uff0c\u7cfb\u7edf\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u53ea\u9700\u8981\u8f93\u5165\u4e4b\u524d\u8bbe\u7f6e\u7684MySQL\u5bc6\u7801\u5373\u53ef\uff0c\u7136\u540e\u7a0b\u5e8f\u4f1a\u8fdb\u5165mysql\u547d\u4ee4\u884c\u6a21\u5f0f\u4e0b\uff0c\u5047\u8bbe\u6211\u4eec\u9700\u8981\u67e5\u770buser\u4fe1\u606f\uff0c\u6211\u4eec\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut84362\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code84362\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\nuse mysql<br \/>\nSELECT host, user, password FROM user;\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\tMySQL\u4f1a\u8fd4\u56de\u6240\u6709host\uff0cuser\u548cpassword\u7b49\u4fe1\u606f\u3002\u5176\u4ed6\u6bd4\u8f83\u590d\u6742\u7684\u64cd\u4f5c\uff0c\u8bf8\u5982\u6dfb\u52a0\u6570\u636e\u5e93\uff0c\u6dfb\u52a0\u8868\u7b49\u548c\u666e\u901a\u7684\u6570\u636e\u64cd\u4f5c\u547d\u4ee4\u4e00\u81f4\uff0c\u540e\u9762\u4f1a\u4ee5\u4e00\u4e2a\u5b9e\u4f8b\u6765\u8bf4\u660e\u3002\u8ba9\u6211\u4eec\u8d76\u5feb\u8fdb\u5165Linux\u4e0bC\u64cd\u4f5cMySQL\u7684\u5b9e\u8df5\u5427\uff01\n<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t3. \u4f7f\u7528C\u8bed\u8a00\u7ba1\u7406MySQL\u6570\u636e\u5e93\uff1a\n<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\tCentOS\u4e0b\u4f7f\u7528MySQL\u8fde\u63a5\u5e93\u7684\u65b9\u5f0f\uff1a\n<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u5b89\u88c5mysql-devel\uff1a yum install mysql-devel\n<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u67e5\u627elibmysqlclient.so\u4f4d\u7f6e\uff1a find \/ -name &#8216;libmysqlclient&#8217;\n<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u7f16\u8bd1\u7a0b\u5e8f\uff0c-L\u6307\u660e\u94fe\u63a5\u5e93\u4f4d\u7f6e\uff1a gcc -o mysql_conn main.c -L\/usr\/lib64\/mysql\/ -lmysqlclient\n<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u5728Linux\u4e0b\u64cd\u4f5cMySQL\u591a\u4f9d\u8d56\u7684\u5e93\uff0c\u5b89\u88c5\u547d\u4ee4\u5982\u4e0b\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut4252\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code4252\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\nsudo apt-get install libmysqlclient-dev\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u5b89\u88c5\u4e86\u8fd9\u4e2a\u4e4b\u540e\uff0c\u6211\u4eec\u7f16\u7a0b\u6240\u9700\u8981\u7684\u5934\u6587\u4ef6\uff0c\u5e93\u6587\u4ef6\u7b49\u5c31\u9f50\u5168\u4e86\uff0c\u8ba9\u6211\u4eec\u5f00\u59cbC\u7f16\u7a0b\u4e4b\u65c5\u5427\uff01\n<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u9996\u5148\uff0c\u8ba9\u6211\u4eec\u51c6\u5907\u4e00\u4e2a\u6211\u4eec\u7528\u6765\u6298\u817e\u7684\u7a7a\u95f4\uff0c\u4e5f\u5c31\u662f\u51c6\u5907\u4e00\u4e2a\u6298\u817e\u4e13\u5c5e\u8d26\u6237\uff0c\u4e00\u4e2a\u6298\u817e\u4e13\u5c5e\u6570\u636e\u5e93\u548c\u6570\u636e\u8868\u7b49\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut71140\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code71140\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\n#\u6dfb\u52a0\u8d26\u6237<br \/>\nGRANT ALL ON *.* TO rick@localhost IDENTIFIED BY &#8216;secret&#8217;<br \/>\n\\q<br \/>\n#\u4f7f\u7528\u65b0\u521b\u5efa\u7684rick\u8d26\u6237\u767b\u5f55<br \/>\nmysql -u rick -p<br \/>\n#\u521b\u5efa\u6570\u636e\u5e93<br \/>\nCREATE DATABASE foo;\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u7136\u540e\uff0c\u6211\u4eec\u4f7f\u7528\u4e00\u4e2asql\u6587\u4ef6\u63d2\u5165\u6570\u636e\u8868\u548c\u6d4b\u8bd5\u6570\u636e\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut70476\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code70476\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\n&#8212;<br \/>\n&#8212; Create the table children<br \/>\n&#8212;<br \/>\nCREATE TABLE children (<br \/>\n&nbsp;&nbsp;&nbsp; childno int(11) NOT NULL auto_increment,<br \/>\n&nbsp;&nbsp;&nbsp; fname varchar(30),<br \/>\n&nbsp;&nbsp;&nbsp; age int(11),<br \/>\n&nbsp;&nbsp;&nbsp; PRIMARY KEY (childno)<br \/>\n);<br \/>\n&#8212;<br \/>\n&#8212; Populate the table &#8216;children&#8217;<br \/>\n&#8212;<br \/>\nINSERT INTO children(childno, fname, age) VALUES (1, &#8216;Jenny&#8217;, 21);<br \/>\nINSERT INTO children(childno, fname, age) VALUES (2, &#8216;Andrew&#8217;, 17);<br \/>\nINSERT INTO children(childno, fname, age) VALUES (3, &#8216;Gavin&#8217;, 8);<br \/>\nINSERT INTO children(childno, fname, age) VALUES (4, &#8216;Duncan&#8217;, 6);<br \/>\nINSERT INTO children(childno, fname, age) VALUES (5, &#8216;Emma&#8217;, 4);<br \/>\nINSERT INTO children(childno, fname, age) VALUES (6, &#8216;Alex&#8217;, 15);<br \/>\nINSERT INTO children(childno, fname, age) VALUES (7, &#8216;Adrian&#8217;, 9);\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u5c06\u4e0a\u8ff0sql\u8bed\u53e5\u5b58\u4e3acreate_children.sql\uff0c\u7136\u540e\u4f7f\u7528\u4e0b\u5217\u547d\u4ee4\u5bfc\u5165MySQL\u6570\u636e\u5e93foo\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut45909\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code45909\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\nmysql -u rick &#8211;password=secret foo<br \/>\n\\. create_children.sql\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u597d\u4e86,\u5199\u4e2ademo\u8fdb\u884c\u6d4b\u8bd5\u5427:\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut19610\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code19610\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\n#include &lt;stdlib.h&gt;<br \/>\n#include &lt;stdio.h&gt;<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;\">\n\t\t#include &#8220;mysql.h&#8221;\n\t<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;\">\n\t\tint main(int argc, char *argv[]) {<br \/>\n&nbsp;&nbsp;&nbsp; MYSQL my_connection;<br \/>\n&nbsp;&nbsp;&nbsp; int res;\n\t<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;\">\n\t\t&nbsp;&nbsp;&nbsp; mysql_init(&amp;my_connection);<br \/>\n&nbsp;&nbsp;&nbsp; if (mysql_real_connect(&amp;my_connection, &#8220;localhost&#8221;,<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;rick&#8221;, &#8220;secret&#8221;, &#8220;foo&#8221;, 0, NULL, 0)) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&#8220;Connection success\\n&#8221;);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; res = mysql_query(&amp;my_connection, &#8220;INSERT INTO children(fname, age) VALUES(&#8216;Ann&#8217;, 3)&#8221;);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!res) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf(&#8220;Inserted %lu rows\\n&#8221;,<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (unsigned long)mysql_affected_rows(&amp;my_connection));<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(stderr, &#8220;Insert error %d: %s\\n&#8221;, mysql_errno(&amp;my_connection), mysql_error(&amp;my_connection));<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }\n\t<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;\">\n\t\t&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mysql_close(&amp;my_connection);<br \/>\n&nbsp;&nbsp;&nbsp; } else {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(stderr, &#8220;Connection failed\\n&#8221;);<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (mysql_error(&amp;my_connection)) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fprintf(stderr, &#8220;Connection error %d: %s\\n&#8221;, mysql_errno(&amp;my_connection), mysql_error(&amp;my_connection));<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br \/>\n&nbsp;&nbsp;&nbsp; }<br \/>\n&nbsp;&nbsp;&nbsp; return EXIT_SUCCESS;<br \/>\n}\n\t<\/p>\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u5c06\u4e0a\u8ff0\u4ee3\u7801\u4fdd\u5b58\u4e3ademo.c\u3002\u4e0a\u8ff0\u4ee3\u7801\u4e2d,\u6211\u4eec\u9700\u8981\u5305\u542bmysql.h\u5934\u6587\u4ef6\u6765\u4f7f\u7528mysql\u63d0\u4f9b\u7684API\u5bf9MySQL\u8fdb\u884c\u64cd\u4f5c\u3002\u7a0b\u5e8f\u5199\u597d\u4e86\uff0c\u7f16\u8bd1\u8fc7\u7a0b\u9700\u8981\u52a0\u5165\u9700\u8981\u7684\u94fe\u63a5\u4fe1\u606f\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut71949\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code71949\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\ngcc -I\/usr\/include\/mysql demo.c -L\/usr\/lib\/mysql -lmysqlclient -o demo\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u597d\u4e86\uff0c\u7a0b\u5e8f\u6210\u529f\u7f16\u8bd1\uff0c\u8fd0\u884c\u4e00\u4e0b\u8bd5\u8bd5\u5427\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut14933\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code14933\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\n.\/demo<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;\">\n\t\t#\u7ed3\u679c\u5982\u4e0b<br \/>\nConnection success<br \/>\nInserted 1 rows\n\t<\/p>\n<p>linux\u4e0b\uff0c\u4f7f\u7528\u4e86codeblocks\uff0c\u6709\u5404\u79cd\u7f16\u5199\u4ee3\u7801\u7684\u65b9\u4fbf\u4e4b\u5904\uff0c\u4f46\u662f\u9047\u5230\u7c7b\u4f3cmysql\u8fd9\u6837\u7684\u6587\u4ef6\uff0c\u7f16\u8bd1\u65f6\u9700\u8981\u9644\u5e26\u94fe\u63a5\u5e93\u7b49\uff0c\u5c31\u611f\u89c9\u624b\u8db3\u65e0\u63aa\uff0c\u4f3c\u4e4e\u5c31\u6ca1\u529e\u6cd5\u7f16\u8bd1\u4e86\uff0c\u672c\u6765\u662f\u7528codeblocks\u7f16\u8f91\u597d\u4ee3\u7801\u540e\uff0c\u4ecd\u7136\u901a\u8fc7\u7ec8\u7aef\u6765\u7f16\u8bd1\uff0c\u4f46\u662f\u6bd5\u7adf\u4e0d\u662f\u4e2a\u529e\u6cd5\uff0cso\uff0c\u679c\u65ad\u767e\u5ea6\u627e\u529e\u6cd5\u2026\u2026\u4ee5\u4e0b\u662f\u641c\u5230\u7684\u53ef\u4ee5\u987a\u5229\u7f16\u8bd1Mysql\u7684\u89e3\u51b3\u65b9\u6cd5\uff1a \u8fdb\u5165project &#8212;&#8212;&gt; build options a. compiler settings tab &#8212;&#8212;-&gt; other options: \u6dfb\u52a0 `mysql_config &#8211;cflags` \uff08\u6b64\u5904\u975e\u5355\u5f15\u53f7\uff0c\u800c\u662f\u53cd\u70b9\uff0c\u5728Tab\u952e\u7684\u4e0a\u9762\u4e00\u4e2a\u6309\u952e\uff09 b. linker settings tab -&gt; other options: \u6dfb\u52a0 `mysql_config &#8211;libs` to get codecompletion you probably need to add the include dir to your project c. search directories tab -&gt; compiler: \u6dfb\u52a0 \/usr\/include\/mysql\u5927\u529f\u544a\u6210\uff0c\u53ef\u4ee5\u8bd5\u8bd5\u4e86~\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t1. MySQL\u7684\u5b89\u88c5\u4e0e\u914d\u7f6e\uff1a\n<\/p>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u5728Ubuntu\u4e0b\u5b89\u88c5MySQL\u65b9\u6cd5\u5f88\u7b80\u5355\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a\n<\/p>\n<div class=\"codetitle\" style=\"border-left-color:#0099CC;border-left-width:1px;border-left-style:solid;padding:0px 3px;margin:3px auto 0px;width:640px;clear:both;font-size:14px;border-top-color:#0099CC;border-top-width:1px;border-top-style:solid;border-right-color:#0099CC;border-right-width:1px;border-right-style:solid;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#F2F6FB;\">\n\t<span style=\"float:right;line-height:25.2000007629395px;font-size:14px;\"><a class=\"copybut\" id=\"copybut84766\" style=\"text-decoration:none;color:#333333;cursor:pointer;\"><u>\u590d\u5236\u4ee3\u7801<\/u><\/a><\/span>\u4ee3\u7801\u5982\u4e0b:\n<\/div>\n<div class=\"codebody\" id=\"code84766\" style=\"border:1px solid #0099CC;padding:0px 3px 0px 5px;margin:0px auto 3px;width:638px;clear:both;font-size:14px;line-height:25.2000007629395px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background:#DDEDFB;\">\n\t<br \/>\nsudo apt-get install mysql-server\n<\/div>\n<p style=\"margin:0px;padding:5px 0px;font-size:14px;color:#000000;font-family:Tahoma, Helvetica, Arial, \u5b8b\u4f53, sans-serif;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:25.2000007629395px;orphans:auto;text-align:left;text-indent:0px;text-transform:none;white-space:normal;widows:1;word-spacing:0px;-webkit-text-stroke-width:0px;background-color:#F7FCFF;\">\n\t\u5b89\u88c5\u7684\u8fc7\u7a0b\u4e2d\u7cfb\u7edf\u4f1a\u63d0\u793a\u8bbe\u7f6eroot\u5bc6\u7801\uff0c\u6b64\u8fc7\u7a0b\u53ef\u4ee5\u8df3\u8fc7\uff0c\u4f46\u662f\u5efa\u8bae\u5728\u5b89\u88c5\u65f6\u63d0\u793a\u8bbe\u7f6eroot\u5bc6\u7801\u7684\u65f6\u5019\u81ea\u884c\u8bbe\u7f6e\uff0c\u514d\u5f97\u540e\u9762\u8bbe\u7f6e\u9ebb\u70e6\u3002\u5b89\u88c5\u7ed3\u675f\u4e4b\u540e\uff0c\u7cfb\u7edf\u4f1a\u542f\u52a8mysql\u670d\u52a1\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u53bb\u67e5\u770b\u6765\u9a8c\u8bc1mys&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[332],"tags":[],"class_list":["post-123","post","type-post","status-publish","format-standard","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[\u8f6c]linux\u5b89\u88c5mysql\u548c\u4f7f\u7528c\u8bed\u8a00\u64cd\u4f5c\u6570\u636e\u5e93\u7684\u65b9\u6cd5 - Wayne&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/weizn.net\/?p=123\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[\u8f6c]linux\u5b89\u88c5mysql\u548c\u4f7f\u7528c\u8bed\u8a00\u64cd\u4f5c\u6570\u636e\u5e93\u7684\u65b9\u6cd5 - Wayne&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"1. MySQL\u7684\u5b89\u88c5\u4e0e\u914d\u7f6e\uff1a    \u5728Ubuntu\u4e0b\u5b89\u88c5MySQL\u65b9\u6cd5\u5f88\u7b80\u5355\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a    \u590d\u5236\u4ee3\u7801\u4ee3\u7801\u5982\u4e0b:     sudo apt-get install mysql-server    \u5b89\u88c5\u7684\u8fc7\u7a0b\u4e2d\u7cfb\u7edf\u4f1a\u63d0\u793a\u8bbe\u7f6eroot\u5bc6\u7801\uff0c\u6b64\u8fc7\u7a0b\u53ef\u4ee5\u8df3\u8fc7\uff0c\u4f46\u662f\u5efa\u8bae\u5728\u5b89\u88c5\u65f6\u63d0\u793a\u8bbe\u7f6eroot\u5bc6\u7801\u7684\u65f6\u5019\u81ea\u884c\u8bbe\u7f6e\uff0c\u514d\u5f97\u540e\u9762\u8bbe\u7f6e\u9ebb\u70e6\u3002\u5b89\u88c5\u7ed3\u675f\u4e4b\u540e\uff0c\u7cfb\u7edf\u4f1a\u542f\u52a8mysql\u670d\u52a1\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u53bb\u67e5\u770b\u6765\u9a8c\u8bc1mys...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/weizn.net\/?p=123\" \/>\n<meta property=\"og:site_name\" content=\"Wayne&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-05-04T17:54:26+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"zinan\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"http:\/\/weizn.net\/#website\",\"url\":\"http:\/\/weizn.net\/\",\"name\":\"Wayne&#039;s Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/weizn.net\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/weizn.net\/?p=123#webpage\",\"url\":\"http:\/\/weizn.net\/?p=123\",\"name\":\"[\\u8f6c]linux\\u5b89\\u88c5mysql\\u548c\\u4f7f\\u7528c\\u8bed\\u8a00\\u64cd\\u4f5c\\u6570\\u636e\\u5e93\\u7684\\u65b9\\u6cd5 - Wayne&#039;s Blog\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/#website\"},\"datePublished\":\"2015-05-04T17:54:26+00:00\",\"dateModified\":\"2015-05-04T17:54:26+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/weizn.net\/?p=123#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/weizn.net\/?p=123\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/weizn.net\/?p=123#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\\u9996\\u9875\",\"item\":\"http:\/\/weizn.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[\\u8f6c]linux\\u5b89\\u88c5mysql\\u548c\\u4f7f\\u7528c\\u8bed\\u8a00\\u64cd\\u4f5c\\u6570\\u636e\\u5e93\\u7684\\u65b9\\u6cd5\"}]},{\"@type\":\"Article\",\"@id\":\"http:\/\/weizn.net\/?p=123#article\",\"isPartOf\":{\"@id\":\"http:\/\/weizn.net\/?p=123#webpage\"},\"author\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"headline\":\"[\\u8f6c]linux\\u5b89\\u88c5mysql\\u548c\\u4f7f\\u7528c\\u8bed\\u8a00\\u64cd\\u4f5c\\u6570\\u636e\\u5e93\\u7684\\u65b9\\u6cd5\",\"datePublished\":\"2015-05-04T17:54:26+00:00\",\"dateModified\":\"2015-05-04T17:54:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/weizn.net\/?p=123#webpage\"},\"wordCount\":588,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\"},\"articleSection\":[\"Linux\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/weizn.net\/?p=123#respond\"]}]},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264\",\"name\":\"zinan\",\"logo\":{\"@id\":\"http:\/\/weizn.net\/#personlogo\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[\u8f6c]linux\u5b89\u88c5mysql\u548c\u4f7f\u7528c\u8bed\u8a00\u64cd\u4f5c\u6570\u636e\u5e93\u7684\u65b9\u6cd5 - Wayne&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/weizn.net\/?p=123","og_locale":"zh_CN","og_type":"article","og_title":"[\u8f6c]linux\u5b89\u88c5mysql\u548c\u4f7f\u7528c\u8bed\u8a00\u64cd\u4f5c\u6570\u636e\u5e93\u7684\u65b9\u6cd5 - Wayne&#039;s Blog","og_description":"1. MySQL\u7684\u5b89\u88c5\u4e0e\u914d\u7f6e\uff1a    \u5728Ubuntu\u4e0b\u5b89\u88c5MySQL\u65b9\u6cd5\u5f88\u7b80\u5355\uff0c\u4f7f\u7528\u5982\u4e0b\u547d\u4ee4\uff1a    \u590d\u5236\u4ee3\u7801\u4ee3\u7801\u5982\u4e0b:     sudo apt-get install mysql-server    \u5b89\u88c5\u7684\u8fc7\u7a0b\u4e2d\u7cfb\u7edf\u4f1a\u63d0\u793a\u8bbe\u7f6eroot\u5bc6\u7801\uff0c\u6b64\u8fc7\u7a0b\u53ef\u4ee5\u8df3\u8fc7\uff0c\u4f46\u662f\u5efa\u8bae\u5728\u5b89\u88c5\u65f6\u63d0\u793a\u8bbe\u7f6eroot\u5bc6\u7801\u7684\u65f6\u5019\u81ea\u884c\u8bbe\u7f6e\uff0c\u514d\u5f97\u540e\u9762\u8bbe\u7f6e\u9ebb\u70e6\u3002\u5b89\u88c5\u7ed3\u675f\u4e4b\u540e\uff0c\u7cfb\u7edf\u4f1a\u542f\u52a8mysql\u670d\u52a1\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u53bb\u67e5\u770b\u6765\u9a8c\u8bc1mys...","og_url":"http:\/\/weizn.net\/?p=123","og_site_name":"Wayne&#039;s Blog","article_published_time":"2015-05-04T17:54:26+00:00","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"zinan","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"http:\/\/weizn.net\/#website","url":"http:\/\/weizn.net\/","name":"Wayne&#039;s Blog","description":"","publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/weizn.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"http:\/\/weizn.net\/?p=123#webpage","url":"http:\/\/weizn.net\/?p=123","name":"[\u8f6c]linux\u5b89\u88c5mysql\u548c\u4f7f\u7528c\u8bed\u8a00\u64cd\u4f5c\u6570\u636e\u5e93\u7684\u65b9\u6cd5 - Wayne&#039;s Blog","isPartOf":{"@id":"http:\/\/weizn.net\/#website"},"datePublished":"2015-05-04T17:54:26+00:00","dateModified":"2015-05-04T17:54:26+00:00","breadcrumb":{"@id":"http:\/\/weizn.net\/?p=123#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/weizn.net\/?p=123"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/weizn.net\/?p=123#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/weizn.net\/"},{"@type":"ListItem","position":2,"name":"[\u8f6c]linux\u5b89\u88c5mysql\u548c\u4f7f\u7528c\u8bed\u8a00\u64cd\u4f5c\u6570\u636e\u5e93\u7684\u65b9\u6cd5"}]},{"@type":"Article","@id":"http:\/\/weizn.net\/?p=123#article","isPartOf":{"@id":"http:\/\/weizn.net\/?p=123#webpage"},"author":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"headline":"[\u8f6c]linux\u5b89\u88c5mysql\u548c\u4f7f\u7528c\u8bed\u8a00\u64cd\u4f5c\u6570\u636e\u5e93\u7684\u65b9\u6cd5","datePublished":"2015-05-04T17:54:26+00:00","dateModified":"2015-05-04T17:54:26+00:00","mainEntityOfPage":{"@id":"http:\/\/weizn.net\/?p=123#webpage"},"wordCount":588,"commentCount":0,"publisher":{"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264"},"articleSection":["Linux"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/weizn.net\/?p=123#respond"]}]},{"@type":["Person","Organization"],"@id":"http:\/\/weizn.net\/#\/schema\/person\/e88bc12c590502d8b6249326f960b264","name":"zinan","logo":{"@id":"http:\/\/weizn.net\/#personlogo"}}]}},"_links":{"self":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/123","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=123"}],"version-history":[{"count":0,"href":"http:\/\/weizn.net\/index.php?rest_route=\/wp\/v2\/posts\/123\/revisions"}],"wp:attachment":[{"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=123"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=123"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/weizn.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=123"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}