{"id":1361,"date":"2016-08-23T09:44:55","date_gmt":"2016-08-23T01:44:55","guid":{"rendered":"http:\/\/www.strongd.net\/?p=1361"},"modified":"2016-08-23T09:44:55","modified_gmt":"2016-08-23T01:44:55","slug":"mysql%e5%85%a5%e9%97%a8%e5%85%a8%e5%a5%97","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=1361","title":{"rendered":"MYSQL\u5165\u95e8\u5168\u5957"},"content":{"rendered":"<h2>mysql\u7b80\u4ecb<\/h2>\n<p>1\u3001\u4ec0\u4e48\u662f\u6570\u636e\u5e93 \uff1f<\/p>\n<p>\u6570\u636e\u5e93\uff08Database\uff09\u662f\u6309\u7167\u6570\u636e\u7ed3\u6784\u6765\u7ec4\u7ec7\u3001\u5b58\u50a8\u548c\u7ba1\u7406\u6570\u636e\u7684\u4ed3\u5e93\uff0c\u5b83\u4ea7\u751f\u4e8e\u8ddd\u4eca\u516d\u5341\u591a\u5e74\u524d\uff0c\u968f\u7740\u4fe1\u606f\u6280\u672f\u548c\u5e02\u573a\u7684\u53d1\u5c55\uff0c\u7279\u522b\u662f\u4e8c\u5341\u4e16\u7eaa\u4e5d\u5341\u5e74\u4ee3\u4ee5\u540e\uff0c\u6570\u636e\u7ba1\u7406\u4e0d\u518d\u4ec5\u4ec5\u662f\u5b58\u50a8\u548c\u7ba1\u7406\u6570\u636e\uff0c\u800c\u8f6c\u53d8\u6210\u7528\u6237\u6240\u9700\u8981\u7684\u5404\u79cd\u6570\u636e\u7ba1\u7406\u7684\u65b9\u5f0f\u3002\u6570\u636e\u5e93\u6709\u5f88\u591a\u79cd\u7c7b\u578b\uff0c\u4ece\u6700\u7b80\u5355\u7684\u5b58\u50a8\u6709\u5404\u79cd\u6570\u636e\u7684\u8868\u683c\u5230\u80fd\u591f\u8fdb\u884c\u6d77\u91cf\u6570\u636e\u5b58\u50a8\u7684\u5927\u578b\u6570\u636e\u5e93\u7cfb\u7edf\u90fd\u5728\u5404\u4e2a\u65b9\u9762\u5f97\u5230\u4e86\u5e7f\u6cdb\u7684\u5e94\u7528\u3002<\/p>\n<p>\u4e3b\u6d41\u7684\u6570\u636e\u5e93\u6709\uff1asqlserver\uff0cmysql\uff0cOracle\u3001SQLite\u3001Access\u3001MS SQL Server\u7b49\uff0c\u672c\u6587\u4e3b\u8981\u8bb2\u8ff0\u7684\u662fmysql<\/p>\n<p>2\u3001\u6570\u636e\u5e93\u7ba1\u7406\u662f\u5e72\u4ec0\u4e48\u7528\u7684\uff1f<\/p>\n<ul>\n<li>a. \u5c06\u6570\u636e\u4fdd\u5b58\u5230\u6587\u4ef6\u6216\u5185\u5b58<\/li>\n<li>b. \u63a5\u6536\u7279\u5b9a\u7684\u547d\u4ee4\uff0c\u7136\u540e\u5bf9\u6587\u4ef6\u8fdb\u884c\u76f8\u5e94\u7684\u64cd\u4f5c<\/li>\n<\/ul>\n<p>PS\uff1a\u5982\u679c\u6709\u4e86\u4ee5\u4e0a\u7ba1\u7406\u7cfb\u7edf\uff0c\u65e0\u987b\u81ea\u5df1\u518d\u53bb\u521b\u5efa\u6587\u4ef6\u548c\u6587\u4ef6\u5939\uff0c\u800c\u662f\u76f4\u63a5\u4f20\u9012 \u547d\u4ee4 \u7ed9\u4e0a\u8ff0\u8f6f\u4ef6\uff0c\u8ba9\u5176\u6765\u8fdb\u884c\u6587\u4ef6\u64cd\u4f5c\uff0c\u4ed6\u4eec\u7edf\u79f0\u4e3a\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff08DBMS\uff0cDatabase Management System\uff09<\/p>\n<h2>mysql\u5b89\u88c5<\/h2>\n<p>MySQL\u662f\u4e00\u79cd\u5f00\u653e\u6e90\u4ee3\u7801\u7684\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff08RDBMS\uff09\uff0cMySQL\u6570\u636e\u5e93\u7cfb\u7edf\u4f7f\u7528\u6700\u5e38\u7528\u7684\u6570\u636e\u5e93\u7ba1\u7406\u8bed\u8a00\u2013\u7ed3\u6784\u5316\u67e5\u8be2\u8bed\u8a00\uff08SQL\uff09\u8fdb\u884c\u6570\u636e\u5e93\u7ba1\u7406\u3002\u5728 WEB \u5e94\u7528\u65b9\u9762MySQL\u662f\u6700\u597d\u7684 RDBMS (Relational Database Management System\uff0c\u5173\u7cfb\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf) \u5e94\u7528\u8f6f\u4ef6\u4e4b\u4e00\u3002<\/p>\n<p>\u4f7f\u7528mysql\u5fc5\u987b\u5177\u5907\u4e00\u4e0b\u6761\u4ef6<\/p>\n<ul>\n<li>\u3000\u3000a. \u5b89\u88c5MySQL\u670d\u52a1\u7aef<\/li>\n<li>\u3000\u3000b. \u5b89\u88c5MySQL\u5ba2\u6237\u7aef<\/li>\n<li>\u3000\u3000b. \u3010\u5ba2\u6237\u7aef\u3011\u8fde\u63a5\u3010\u670d\u52a1\u7aef\u3011<\/li>\n<li>\u3000\u3000c. \u3010\u5ba2\u6237\u7aef\u3011\u53d1\u9001\u547d\u4ee4\u7ed9\u3010\u670d\u52a1\u7aefMySQL\u3011\u670d\u52a1\u7684\u63a5\u53d7\u547d\u4ee4\u5e76\u6267\u884c\u76f8\u5e94\u64cd\u4f5c(\u589e\u5220\u6539\u67e5\u7b49)<\/li>\n<\/ul>\n<p>1\u3001\u4e0b\u8f7d\u5730\u5740\uff1a<code>http:<\/code><code>\/\/dev.mysql.com\/downloads\/mysql\/<\/code><\/p>\n<p>2\u3001\u5b89\u88c5<\/p>\n<ul>\n<li>windows\u5b89\u88c5\u8bf7\u53c2\u8003\uff1a<a href=\"http:\/\/www.cnblogs.com\/lonelywolfmoutain\/p\/4547115.html\" target=\"_blank\">http:\/\/www.c<wbr \/>nblogs.com\/l<wbr \/>onelywolfmou<wbr \/>tain\/p\/45471<wbr \/>15.html<\/a><\/li>\n<li>linux\u4e0b\u5b89\u88c5\uff1a<a href=\"http:\/\/www.cnblogs.com\/chenjunbiao\/archive\/2011\/01\/24\/1940256.html\" target=\"_blank\">http:\/\/www.c<wbr \/>nblogs.com\/c<wbr \/>henjunbiao\/a<wbr \/>rchive\/2011\/<wbr \/>01\/24\/194025<wbr \/>6.html<\/a><\/li>\n<\/ul>\n<p>\u6ce8\uff1a\u4ee5\u4e0a\u4e24\u4e2a\u94fe\u63a5\u6709\u5b8c\u6574\u7684\u5b89\u88c5\u65b9\u5f0f\uff0c\u64b8\u4e3b\u4e5f\u662f\u53c2\u8003\u4ed6\u7684\u5b89\u88c5\u7684\uff0c\u5b89\u88c5\u5b8c\u4ee5\u540emysql.server start\u542f\u52a8mysql\u670d\u52a1<\/p>\n<h2>mysql\u64cd\u4f5c<\/h2>\n<p>\u4e00\u3001\u8fde\u63a5\u6570\u636e\u5e93<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">mysql  -u user -p                   \u4f8b\uff1amysql -u root -p<\/pre>\n<\/div>\n<p>\u5e38\u89c1\u9519\u8bef\u5982\u4e0b\uff1a<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">ERROR 2002 (HY000): Can't connect to local MySQL server through socket '\/tmp\/mysql.sock' (2), it means that the MySQL server daemon (Unix) or service (Windows) is not running.<\/pre>\n<\/div>\n<p>\u9000\u51fa\u8fde\u63a5\uff1a<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">QUIT \u6216\u8005 Ctrl+D<\/pre>\n<\/div>\n<p>\u4e8c\u3001\u67e5\u770b\u6570\u636e\u5e93\uff0c\u521b\u5efa\u6570\u636e\u5e93\uff0c\u4f7f\u7528\u6570\u636e\u5e93\u67e5\u770b\u6570\u636e\u5e93: show databases;<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">\u9ed8\u8ba4\u6570\u636e\u5e93\uff1a\r\n\u3000          \u3000 mysql - \u7528\u6237\u6743\u9650\u76f8\u5173\u6570\u636e\r\n\u3000\u3000           test - \u7528\u4e8e\u7528\u6237\u6d4b\u8bd5\u6570\u636e\r\n\u3000          \u3000 information_schema - MySQL\u672c\u8eab\u67b6\u6784\u76f8\u5173\u6570\u636e\r\n \r\n\u521b\u5efa\u6570\u636e\u5e93:     \r\n               create database db1 DEFAULT CHARSET utf8 COLLATE utf8_general_ci;     # utf8\u7f16\u7801                       create database db1 DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci; # gbk\u7f16\u7801\r\n\u4f7f\u7528\u6570\u636e\u5e93:     use db1;<\/pre>\n<\/div>\n<p>\u663e\u793a\u5f53\u524d\u4f7f\u7528\u7684\u6570\u636e\u5e93\u4e2d\u6240\u6709\u8868\uff1aSHOW TABLES;<\/p>\n<p>\u4e09\u3001\u7528\u6237\u7ba1\u7406<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">\u521b\u5efa\u7528\u6237\r\n    create user '\u7528\u6237\u540d'@'IP\u5730\u5740' identified by '\u5bc6\u7801';\r\n\u5220\u9664\u7528\u6237\r\n    drop user '\u7528\u6237\u540d'@'IP\u5730\u5740';\r\n\u4fee\u6539\u7528\u6237\r\n    rename user '\u7528\u6237\u540d'@'IP\u5730\u5740'; to '\u65b0\u7528\u6237\u540d'@'IP\u5730\u5740'$$\r\n\u4fee\u6539\u5bc6\u7801\r\n    set password for '\u7528\u6237\u540d'@'IP\u5730\u5740' = Password('\u65b0\u5bc6\u7801')<\/pre>\n<\/div>\n<p>\u6ce8\uff1a\u7528\u6237\u6743\u9650\u76f8\u5173\u6570\u636e\u4fdd\u5b58\u5728mysql\u6570\u636e\u5e93\u7684user\u8868\u4e2d\uff0c\u6240\u4ee5\u4e5f\u53ef\u4ee5\u76f4\u63a5\u5bf9\u5176\u8fdb\u884c\u64cd\u4f5c\uff08\u4e0d\u5efa\u8bae\uff09<\/p>\n<p>\u56db\u3001\u6743\u9650\u7ba1\u7406<\/p>\n<p>mysql\u5bf9\u4e8e\u6743\u9650\u8fd9\u5757\u6709\u4ee5\u4e0b\u9650\u5236\uff1a<\/p>\n<div>\n<div id=\"cnblogs_code_open_0e11f482-6c9f-46a3-92e6-af26ca88f33d\">\n<pre class=\"crayon-plain-tag\">all privileges          \u9664grant\u5916\u7684\u6240\u6709\u6743\u9650\r\n            select                  \u4ec5\u67e5\u6743\u9650\r\n            select,insert           \u67e5\u548c\u63d2\u5165\u6743\u9650\r\n            ...\r\n            usage                   \u65e0\u8bbf\u95ee\u6743\u9650\r\n            alter                   \u4f7f\u7528alter table\r\n            alter routine           \u4f7f\u7528alter procedure\u548cdrop procedure\r\n            create                  \u4f7f\u7528create table\r\n            create routine          \u4f7f\u7528create procedure\r\n            create temporary tables \u4f7f\u7528create temporary tables\r\n            create user             \u4f7f\u7528create user\u3001drop user\u3001rename user\u548crevoke  all privileges\r\n            create view             \u4f7f\u7528create view\r\n            delete                  \u4f7f\u7528delete\r\n            drop                    \u4f7f\u7528drop table\r\n            execute                 \u4f7f\u7528call\u548c\u5b58\u50a8\u8fc7\u7a0b\r\n            file                    \u4f7f\u7528select into outfile \u548c load data infile\r\n            grant option            \u4f7f\u7528grant \u548c revoke\r\n            index                   \u4f7f\u7528index\r\n            insert                  \u4f7f\u7528insert\r\n            lock tables             \u4f7f\u7528lock table\r\n            process                 \u4f7f\u7528show full processlist\r\n            select                  \u4f7f\u7528select\r\n            show databases          \u4f7f\u7528show databases\r\n            show view               \u4f7f\u7528show view\r\n            update                  \u4f7f\u7528update\r\n            reload                  \u4f7f\u7528flush\r\n            shutdown                \u4f7f\u7528mysqladmin shutdown(\u5173\u95edMySQL)\r\n            super                   \u4f7f\u7528change master\u3001kill\u3001logs\u3001purge\u3001master\u548cset global\u3002\u8fd8\u5141\u8bb8mysqladmin\u8c03\u8bd5\u767b\u9646\r\n            replication client      \u670d\u52a1\u5668\u4f4d\u7f6e\u7684\u8bbf\u95ee\r\n            replication slave       \u7531\u590d\u5236\u4ece\u5c5e\u4f7f\u7528<\/pre>\n<\/div>\n<\/div>\n<p>\u5bf9\u4e8e\u6570\u636e\u5e93\u53ca\u5185\u90e8\u5176\u4ed6\u6743\u9650\u5982\u4e0b\uff1a<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">\u6570\u636e\u5e93\u540d.*           \u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709\r\n            \u6570\u636e\u5e93\u540d.\u8868          \u6307\u5b9a\u6570\u636e\u5e93\u4e2d\u7684\u67d0\u5f20\u8868\r\n            \u6570\u636e\u5e93\u540d.\u5b58\u50a8\u8fc7\u7a0b     \u6307\u5b9a\u6570\u636e\u5e93\u4e2d\u7684\u5b58\u50a8\u8fc7\u7a0b\r\n            *.*                \u6240\u6709\u6570\u636e\u5e93<\/pre>\n<\/div>\n<p>\u5bf9\u4e8e\u7528\u6237\u548cIP\u7684\u6743\u9650\u5982\u4e0b\uff1a<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">\u7528\u6237\u540d@IP\u5730\u5740         \u7528\u6237\u53ea\u80fd\u5728\u6539IP\u4e0b\u624d\u80fd\u8bbf\u95ee\r\n            \u7528\u6237\u540d@192.168.1.%   \u7528\u6237\u53ea\u80fd\u5728\u6539IP\u6bb5\u4e0b\u624d\u80fd\u8bbf\u95ee(\u901a\u914d\u7b26%\u8868\u793a\u4efb\u610f)\r\n            \u7528\u6237\u540d@%             \u7528\u6237\u53ef\u4ee5\u518d\u4efb\u610fIP\u4e0b\u8bbf\u95ee(\u9ed8\u8ba4IP\u5730\u5740\u4e3a%)<\/pre>\n<\/div>\n<p>1\u3001\u67e5\u770b\u6743\u9650\uff1a<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">show grants for '\u7528\u6237'@'IP\u5730\u5740'<\/pre>\n<\/div>\n<p>2\u3001\u6388\u6743<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">grant  \u6743\u9650 on \u6570\u636e\u5e93.\u8868 to   '\u7528\u6237'@'IP\u5730\u5740'<\/pre>\n<\/div>\n<p>3\u3001\u53d6\u6d88\u6388\u6743<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">revoke \u6743\u9650 on \u6570\u636e\u5e93.\u8868 from '\u7528\u6237'@'IP\u5730\u5740'<\/pre>\n<\/div>\n<p>\u6388\u6743\u5b9e\u4f8b\u5982\u4e0b\uff1a<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">grant all privileges on db1.tb1 TO '\u7528\u6237\u540d'@'IP'\r\n\r\ngrant select on db1.* TO '\u7528\u6237\u540d'@'IP'\r\n\r\ngrant select,insert on *.* TO '\u7528\u6237\u540d'@'IP'\r\n\r\nrevoke select on db1.tb1 from '\u7528\u6237\u540d'@'IP'<\/pre>\n<\/div>\n<h2>mysql\u8868\u64cd\u4f5c<\/h2>\n<p>1\u3001\u67e5\u770b\u8868<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">show tables;                    # \u67e5\u770b\u6570\u636e\u5e93\u5168\u90e8\u8868\r\n\r\nselect * from \u8868\u540d;             # \u67e5\u770b\u8868\u6240\u6709\u5185\u5bb9<\/pre>\n<\/div>\n<p>2\u3001\u521b\u5efa\u8868<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">create table \u8868\u540d(\r\n    \u5217\u540d  \u7c7b\u578b  \u662f\u5426\u53ef\u4ee5\u4e3a\u7a7a\uff0c\r\n    \u5217\u540d  \u7c7b\u578b  \u662f\u5426\u53ef\u4ee5\u4e3a\u7a7a\r\n)ENGINE=InnoDB DEFAULT CHARSET=utf8<\/pre>\n<\/div>\n<p>\u6765\u4e00\u4e2a\u5b9e\u4f8b\u597d\u8be6\u89e3<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">CREATE TABLE `tab1` (\r\n  `nid` int(11) NOT NULL auto_increment,                   # not null\u8868\u793a\u4e0d\u80fd\u4e3a\u7a7a,auto_increment\u8868\u793a\u81ea\u589e\r\n  `name` varchar(255) DEFAULT zhangyanlin,                 # default \u8868\u793a\u9ed8\u8ba4\u503c\r\n  `email` varchar(255),\r\n  PRIMARY KEY (`nid`)                                      # \u628anid\u5217\u8bbe\u7f6e\u6210\u4e3b\u952e\r\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;<\/pre>\n<\/div>\n<p>\u6ce8\uff1a<\/p>\n<ul>\n<li>\u9ed8\u8ba4\u503c\uff0c\u521b\u5efa\u5217\u65f6\u53ef\u4ee5\u6307\u5b9a\u9ed8\u8ba4\u503c\uff0c\u5f53\u63d2\u5165\u6570\u636e\u65f6\u5982\u679c\u672a\u4e3b\u52a8\u8bbe\u7f6e\uff0c\u5219\u81ea\u52a8\u6dfb\u52a0\u9ed8\u8ba4\u503c<\/li>\n<li>\u81ea\u589e\uff0c\u5982\u679c\u4e3a\u67d0\u5217\u8bbe\u7f6e\u81ea\u589e\u5217\uff0c\u63d2\u5165\u6570\u636e\u65f6\u65e0\u9700\u8bbe\u7f6e\u6b64\u5217\uff0c\u9ed8\u8ba4\u5c06\u81ea\u589e\uff08\u8868\u4e2d\u53ea\u80fd\u6709\u4e00\u4e2a\u81ea\u589e\u5217\uff09\u6ce8\u610f\uff1a1\u3001\u5bf9\u4e8e\u81ea\u589e\u5217\uff0c\u5fc5\u987b\u662f\u7d22\u5f15\uff08\u542b\u4e3b\u952e\uff092\u3001\u5bf9\u4e8e\u81ea\u589e\u53ef\u4ee5\u8bbe\u7f6e\u6b65\u957f\u548c\u8d77\u59cb\u503c<\/li>\n<li>\u4e3b\u952e\uff0c\u4e00\u79cd\u7279\u6b8a\u7684\u552f\u4e00\u7d22\u5f15\uff0c\u4e0d\u5141\u8bb8\u6709\u7a7a\u503c\uff0c\u5982\u679c\u4e3b\u952e\u4f7f\u7528\u5355\u4e2a\u5217\uff0c\u5219\u5b83\u7684\u503c\u5fc5\u987b\u552f\u4e00\uff0c\u5982\u679c\u662f\u591a\u5217\uff0c\u5219\u5176\u7ec4\u5408\u5fc5\u987b\u552f\u4e00\u3002<\/li>\n<\/ul>\n<p>3\u3001\u5220\u9664\u8868<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">drop table \u8868\u540d<\/pre>\n<\/div>\n<p>3\u3001\u6e05\u7a7a\u8868\u5185\u5bb9<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">delete from \u8868\u540d\r\ntruncate table \u8868\u540d<\/pre>\n<\/div>\n<p>4\u3001\u4fee\u6539\u8868<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">\u6dfb\u52a0\u5217\uff1a   alter table \u8868\u540d add \u5217\u540d \u7c7b\u578b\r\n\u5220\u9664\u5217\uff1a   alter table \u8868\u540d drop column \u5217\u540d\r\n\u4fee\u6539\u5217\uff1a\r\n          alter table \u8868\u540d modify column \u5217\u540d \u7c7b\u578b;  -- \u7c7b\u578b\r\n          alter table \u8868\u540d change \u539f\u5217\u540d \u65b0\u5217\u540d \u7c7b\u578b; -- \u5217\u540d\uff0c\u7c7b\u578b\r\n  \r\n\u6dfb\u52a0\u4e3b\u952e\uff1a\r\n          alter table \u8868\u540d add primary key(\u5217\u540d);\r\n\u5220\u9664\u4e3b\u952e\uff1a\r\n          alter table \u8868\u540d drop primary key;\r\n          alter table \u8868\u540d  modify  \u5217\u540d int, drop primary key;\r\n  \r\n\u6dfb\u52a0\u5916\u952e\uff1a alter table \u4ece\u8868 add constraint \u5916\u952e\u540d\u79f0\uff08\u5f62\u5982\uff1aFK_\u4ece\u8868_\u4e3b\u8868\uff09 foreign key \u4ece\u8868(\u5916\u952e\u5b57\u6bb5) references \u4e3b\u8868(\u4e3b\u952e\u5b57\u6bb5);\r\n\u5220\u9664\u5916\u952e\uff1a alter table \u8868\u540d drop foreign key \u5916\u952e\u540d\u79f0\r\n  \r\n\u4fee\u6539\u9ed8\u8ba4\u503c\uff1aALTER TABLE testalter_tbl ALTER i SET DEFAULT 1000;\r\n\u5220\u9664\u9ed8\u8ba4\u503c\uff1aALTER TABLE testalter_tbl ALTER i DROP DEFAULT;<\/pre>\n<\/div>\n<p>\u5bf9\u4e8e\u4e0a\u8ff0\u8fd9\u4e9b\u64cd\u4f5c\u662f\u4e0d\u662f\u770b\u8d77\u6765\u5f88\u9ebb\u70e6\uff0c\u5f88\u6d6a\u8d39\u65f6\u95f4\uff0c\u522b\u614c\uff01\u6709\u4e13\u95e8\u7684\u8f6f\u4ef6\u80fd\u63d0\u4f9b\u8fd9\u4e9b\u529f\u80fd\uff0c\u64cd\u4f5c\u8d77\u6765\u975e\u5e38\u7b80\u5355\uff0c\u8fd9\u4e2a\u8f6f\u4ef6\u540d\u5b57\u53eb<strong>Navicat Premium<\/strong>\u00a0\uff0c\u5927\u5bb6\u81ea\u884c\u5728\u7f51\u4e0a\u4e0b\u8f7d\uff0c\u7ec3\u7ec3\u624b\uff0c\u4f46\u662f\u4e0b\u9762\u7684\u5373\u5c06\u8bb2\u5230\u8868\u5185\u5bb9\u64cd\u4f5c\u8fd8\u662f\u5efa\u8bae\u81ea\u5df1\u5199\u547d\u4ee4\u6765\u8fdb\u884c<\/p>\n<p>5\u3001\u57fa\u672c\u6570\u636e\u7c7b\u578b<\/p>\n<p>MySQL\u7684\u6570\u636e\u7c7b\u578b\u5927\u81f4\u5206\u4e3a\uff1a\u6570\u503c\u3001\u65f6\u95f4\u548c\u5b57\u7b26\u4e32<\/p>\n<div>\n<div id=\"cnblogs_code_open_ac479300-d074-4947-8786-96c0286cdc3d\">\n<pre class=\"crayon-plain-tag\">bit[(M)]\r\n            \u4e8c\u8fdb\u5236\u4f4d\uff08101001\uff09\uff0cm\u8868\u793a\u4e8c\u8fdb\u5236\u4f4d\u7684\u957f\u5ea6\uff081-64\uff09\uff0c\u9ed8\u8ba4m\uff1d1\r\n\r\n        tinyint[(m)] [unsigned] [zerofill]\r\n\r\n            \u5c0f\u6574\u6570\uff0c\u6570\u636e\u7c7b\u578b\u7528\u4e8e\u4fdd\u5b58\u4e00\u4e9b\u8303\u56f4\u7684\u6574\u6570\u6570\u503c\u8303\u56f4\uff1a\r\n            \u6709\u7b26\u53f7\uff1a\r\n                -128 \uff5e 127.\r\n            \u65e0\u7b26\u53f7\uff1a\r\n                0 \uff5e 255\r\n\r\n            \u7279\u522b\u7684\uff1a MySQL\u4e2d\u65e0\u5e03\u5c14\u503c\uff0c\u4f7f\u7528tinyint(1)\u6784\u9020\u3002\r\n\r\n        int[(m)][unsigned][zerofill]\r\n\r\n            \u6574\u6570\uff0c\u6570\u636e\u7c7b\u578b\u7528\u4e8e\u4fdd\u5b58\u4e00\u4e9b\u8303\u56f4\u7684\u6574\u6570\u6570\u503c\u8303\u56f4\uff1a\r\n                \u6709\u7b26\u53f7\uff1a\r\n                    -2147483648 \uff5e 2147483647\r\n                \u65e0\u7b26\u53f7\uff1a\r\n                    0 \uff5e 4294967295\r\n\r\n            \u7279\u522b\u7684\uff1a\u6574\u6570\u7c7b\u578b\u4e2d\u7684m\u4ec5\u7528\u4e8e\u663e\u793a\uff0c\u5bf9\u5b58\u50a8\u8303\u56f4\u65e0\u9650\u5236\u3002\u4f8b\u5982\uff1a int(5),\u5f53\u63d2\u5165\u6570\u636e2\u65f6\uff0cselect \u65f6\u6570\u636e\u663e\u793a\u4e3a\uff1a 00002\r\n\r\n        bigint[(m)][unsigned][zerofill]\r\n            \u5927\u6574\u6570\uff0c\u6570\u636e\u7c7b\u578b\u7528\u4e8e\u4fdd\u5b58\u4e00\u4e9b\u8303\u56f4\u7684\u6574\u6570\u6570\u503c\u8303\u56f4\uff1a\r\n                \u6709\u7b26\u53f7\uff1a\r\n                    -9223372036854775808 \uff5e 9223372036854775807\r\n                \u65e0\u7b26\u53f7\uff1a\r\n                    0  \uff5e  18446744073709551615\r\n\r\n        decimal[(m[,d])] [unsigned] [zerofill]\r\n            \u51c6\u786e\u7684\u5c0f\u6570\u503c\uff0cm\u662f\u6570\u5b57\u603b\u4e2a\u6570\uff08\u8d1f\u53f7\u4e0d\u7b97\uff09\uff0cd\u662f\u5c0f\u6570\u70b9\u540e\u4e2a\u6570\u3002 m\u6700\u5927\u503c\u4e3a65\uff0cd\u6700\u5927\u503c\u4e3a30\u3002\r\n\r\n            \u7279\u522b\u7684\uff1a\u5bf9\u4e8e\u7cbe\u786e\u6570\u503c\u8ba1\u7b97\u65f6\u9700\u8981\u7528\u6b64\u7c7b\u578b\r\n                   decaimal\u80fd\u591f\u5b58\u50a8\u7cbe\u786e\u503c\u7684\u539f\u56e0\u5728\u4e8e\u5176\u5185\u90e8\u6309\u7167\u5b57\u7b26\u4e32\u5b58\u50a8\u3002\r\n\r\n        FLOAT[(M,D)] [UNSIGNED] [ZEROFILL]\r\n            \u5355\u7cbe\u5ea6\u6d6e\u70b9\u6570\uff08\u975e\u51c6\u786e\u5c0f\u6570\u503c\uff09\uff0cm\u662f\u6570\u5b57\u603b\u4e2a\u6570\uff0cd\u662f\u5c0f\u6570\u70b9\u540e\u4e2a\u6570\u3002\r\n                \u65e0\u7b26\u53f7\uff1a\r\n                    -3.402823466E+38 to -1.175494351E-38,\r\n                    0\r\n                    1.175494351E-38 to 3.402823466E+38\r\n                \u6709\u7b26\u53f7\uff1a\r\n                    0\r\n                    1.175494351E-38 to 3.402823466E+38\r\n\r\n            **** \u6570\u503c\u8d8a\u5927\uff0c\u8d8a\u4e0d\u51c6\u786e ****\r\n\r\n        DOUBLE[(M,D)] [UNSIGNED] [ZEROFILL]\r\n            \u53cc\u7cbe\u5ea6\u6d6e\u70b9\u6570\uff08\u975e\u51c6\u786e\u5c0f\u6570\u503c\uff09\uff0cm\u662f\u6570\u5b57\u603b\u4e2a\u6570\uff0cd\u662f\u5c0f\u6570\u70b9\u540e\u4e2a\u6570\u3002\r\n\r\n                \u65e0\u7b26\u53f7\uff1a\r\n                    -1.7976931348623157E+308 to -2.2250738585072014E-308\r\n                    0\r\n                    2.2250738585072014E-308 to 1.7976931348623157E+308\r\n                \u6709\u7b26\u53f7\uff1a\r\n                    0\r\n                    2.2250738585072014E-308 to 1.7976931348623157E+308\r\n            **** \u6570\u503c\u8d8a\u5927\uff0c\u8d8a\u4e0d\u51c6\u786e ****\r\n\r\n\r\n        char (m)\r\n            char\u6570\u636e\u7c7b\u578b\u7528\u4e8e\u8868\u793a\u56fa\u5b9a\u957f\u5ea6\u7684\u5b57\u7b26\u4e32\uff0c\u53ef\u4ee5\u5305\u542b\u6700\u591a\u8fbe255\u4e2a\u5b57\u7b26\u3002\u5176\u4e2dm\u4ee3\u8868\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u3002\r\n            PS: \u5373\u4f7f\u6570\u636e\u5c0f\u4e8em\u957f\u5ea6\uff0c\u4e5f\u4f1a\u5360\u7528m\u957f\u5ea6\r\n        varchar(m)\r\n            varchars\u6570\u636e\u7c7b\u578b\u7528\u4e8e\u53d8\u957f\u7684\u5b57\u7b26\u4e32\uff0c\u53ef\u4ee5\u5305\u542b\u6700\u591a\u8fbe255\u4e2a\u5b57\u7b26\u3002\u5176\u4e2dm\u4ee3\u8868\u8be5\u6570\u636e\u7c7b\u578b\u6240\u5141\u8bb8\u4fdd\u5b58\u7684\u5b57\u7b26\u4e32\u7684\u6700\u5927\u957f\u5ea6\uff0c\u53ea\u8981\u957f\u5ea6\u5c0f\u4e8e\u8be5\u6700\u5927\u503c\u7684\u5b57\u7b26\u4e32\u90fd\u53ef\u4ee5\u88ab\u4fdd\u5b58\u5728\u8be5\u6570\u636e\u7c7b\u578b\u4e2d\u3002\r\n\r\n            \u6ce8\uff1a\u867d\u7136varchar\u4f7f\u7528\u8d77\u6765\u8f83\u4e3a\u7075\u6d3b\uff0c\u4f46\u662f\u4ece\u6574\u4e2a\u7cfb\u7edf\u7684\u6027\u80fd\u89d2\u5ea6\u6765\u8bf4\uff0cchar\u6570\u636e\u7c7b\u578b\u7684\u5904\u7406\u901f\u5ea6\u66f4\u5feb\uff0c\u6709\u65f6\u751a\u81f3\u53ef\u4ee5\u8d85\u51favarchar\u5904\u7406\u901f\u5ea6\u768450%\u3002\u56e0\u6b64\uff0c\u7528\u6237\u5728\u8bbe\u8ba1\u6570\u636e\u5e93\u65f6\u5e94\u5f53\u7efc\u5408\u8003\u8651\u5404\u65b9\u9762\u7684\u56e0\u7d20\uff0c\u4ee5\u6c42\u8fbe\u5230\u6700\u4f73\u7684\u5e73\u8861\r\n\r\n        text\r\n            text\u6570\u636e\u7c7b\u578b\u7528\u4e8e\u4fdd\u5b58\u53d8\u957f\u7684\u5927\u5b57\u7b26\u4e32\uff0c\u53ef\u4ee5\u7ec4\u591a\u523065535 (2**16 \u2212 1)\u4e2a\u5b57\u7b26\u3002\r\n\r\n        mediumtext\r\n            A TEXT column with a maximum length of 16,777,215 (2**24 \u2212 1) characters.\r\n\r\n        longtext\r\n            A TEXT column with a maximum length of 4,294,967,295 or 4GB (2**32 \u2212 1) characters.\r\n\r\n\r\n        enum\r\n            \u679a\u4e3e\u7c7b\u578b\uff0c\r\n            An ENUM column can have a maximum of 65,535 distinct elements. (The practical limit is less than 3000.)\r\n            \u793a\u4f8b\uff1a\r\n                CREATE TABLE shirts (\r\n                    name VARCHAR(40),\r\n                    size ENUM('x-small', 'small', 'medium', 'large', 'x-large')\r\n                );\r\n                INSERT INTO shirts (name, size) VALUES ('dress shirt','large'), ('t-shirt','medium'),('polo shirt','small');\r\n\r\n        set\r\n            \u96c6\u5408\u7c7b\u578b\r\n            A SET column can have a maximum of 64 distinct members.\r\n            \u793a\u4f8b\uff1a\r\n                CREATE TABLE myset (col SET('a', 'b', 'c', 'd'));\r\n                INSERT INTO myset (col) VALUES ('a,d'), ('d,a'), ('a,d,a'), ('a,d,d'), ('d,a,d');\r\n\r\n        DATE\r\n            YYYY-MM-DD\uff081000-01-01\/9999-12-31\uff09\r\n\r\n        TIME\r\n            HH:MM:SS\uff08'-838:59:59'\/'838:59:59'\uff09\r\n\r\n        YEAR\r\n            YYYY\uff081901\/2155\uff09\r\n\r\n        DATETIME\r\n\r\n            YYYY-MM-DD HH:MM:SS\uff081000-01-01 00:00:00\/9999-12-31 23:59:59    Y\uff09\r\n\r\n        TIMESTAMP\r\n\r\n            YYYYMMDD HHMMSS\uff081970-01-01 00:00:00\/2037 \u5e74\u67d0\u65f6\uff09<\/pre>\n<h2>mysql\u8868\u5185\u5bb9\u64cd\u4f5c<\/h2>\n<p>\u8868\u5185\u5bb9\u64cd\u4f5c\u65e0\u975e\u5c31\u662f\u589e\u5220\u6539\u67e5\uff0c\u5f53\u7136\u7528\u7684\u6700\u591a\u7684\u8fd8\u662f\u67e5\uff0c\u800c\u4e14\u67e5\u8fd9\u4e00\u5757\u4e1c\u897f\u6700\u591a\uff0c\u7528\u8d77\u6765\u6700\u96be\uff0c\u5f53\u7136\u5bf9\u4e8e\u5927\u795e\u6765\u8bf4\u90a3\u5c31\u662fso easy\u4e86\uff0c\u5bf9\u4e8e\u6211\u8fd9\u79cd\u5c0f\u767d\u8fd8\u662f\u975e\u5e38\u96be\u4ee5\u7075\u6d3b\u8fd0\u7528\u7684\uff0c\u4e0b\u9762\u54b1\u6765\u4e00\u4e00\u64cd\u4f5c\u4e00\u4e0b<\/p>\n<p>1\u3001\u589e<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">insert into \u8868 (\u5217\u540d,\u5217\u540d...) values (\u503c,\u503c,...)\r\ninsert into \u8868 (\u5217\u540d,\u5217\u540d...) values (\u503c,\u503c,...),(\u503c,\u503c,\u503c...)\r\ninsert into \u8868 (\u5217\u540d,\u5217\u540d...) select (\u5217\u540d,\u5217\u540d...) from \u8868\r\n\u4f8b\uff1a\r\n    insert into tab1(name,email) values('zhangyanlin','zhangyanlin8851@163.com')<\/pre>\n<\/div>\n<p>2\u3001\u5220<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">delete from \u8868                                      # \u5220\u9664\u8868\u91cc\u5168\u90e8\u6570\u636e\r\ndelete from \u8868 where id\uff1d1 and name\uff1d'zhangyanlin'   # \u5220\u9664ID =1 \u548cname='zhangyanlin' \u90a3\u4e00\u884c\u6570\u636e<\/pre>\n<\/div>\n<p>3\u3001\u6539<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">update \u8868 set name \uff1d 'zhangyanlin' where id&gt;1<\/pre>\n<\/div>\n<p>4\u3001\u67e5<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">select * from \u8868\r\nselect * from \u8868 where id &gt; 1\r\nselect nid,name,gender as gg from \u8868 where id &gt; 1<\/pre>\n<\/div>\n<p>\u67e5\u8fd9\u5757\u7684\u6761\u4ef6\u592a\u591a\u592a\u591a\u6211\u7ed9\u5217\u4e3e\u51fa\u6765\u81f3\u4e8e\u7ec4\u5408\u8fd8\u5f97\u770b\u5927\u5bb6\u7684\u7406\u89e3\u7a0b\u5ea6\u54c8<\/p>\n<p>a\u3001\u6761\u4ef6\u5224\u65adwhere<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">select * from \u8868 where id &gt; 1 and name != 'aylin' and num = 12;\r\n    select * from \u8868 where id between 5 and 16;\r\n    select * from \u8868 where id in (11,22,33)\r\n    select * from \u8868 where id not in (11,22,33)\r\n    select * from \u8868 where id in (select nid from \u8868)<\/pre>\n<\/div>\n<p>b\u3001\u901a\u914d\u7b26like<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">select * from \u8868 where name like 'zhang%'  # zhang\u5f00\u5934\u7684\u6240\u6709\uff08\u591a\u4e2a\u5b57\u7b26\u4e32\uff09\r\n    select * from \u8868 where name like 'zhang_'  # zhang\u5f00\u5934\u7684\u6240\u6709\uff08\u4e00\u4e2a\u5b57\u7b26\uff09<\/pre>\n<\/div>\n<p>c\u3001\u9650\u5236limit<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">select * from \u8868 limit 5;            - \u524d5\u884c\r\n    select * from \u8868 limit 4,5;          - \u4ece\u7b2c4\u884c\u5f00\u59cb\u76845\u884c\r\n    select * from \u8868 limit 5 offset 4    - \u4ece\u7b2c4\u884c\u5f00\u59cb\u76845\u884c<\/pre>\n<\/div>\n<p>d\u3001\u6392\u5e8fasc\uff0cdesc<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">select * from \u8868 order by \u5217 asc              - \u6839\u636e \u201c\u5217\u201d \u4ece\u5c0f\u5230\u5927\u6392\u5217\r\n    select * from \u8868 order by \u5217 desc             - \u6839\u636e \u201c\u5217\u201d \u4ece\u5927\u5230\u5c0f\u6392\u5217\r\n    select * from \u8868 order by \u52171 desc,\u52172 asc    - \u6839\u636e \u201c\u52171\u201d \u4ece\u5927\u5230\u5c0f\u6392\u5217\uff0c\u5982\u679c\u76f8\u540c\u5219\u6309\u52172\u4ece\u5c0f\u5230\u5927\u6392\u5e8f<\/pre>\n<\/div>\n<p>e\u3001\u5206\u7ec4group by<\/p>\n<div>\n<pre class=\"crayon-plain-tag\">select num from \u8868 group by num\r\n    select num,nid from \u8868 group by num,nid\r\n    select num,nid from \u8868  where nid &gt; 10 group by num,nid order nid desc\r\n    select num,nid,count(*),sum(score),max(score),min(score) from \u8868 group by num,nid\r\n    select num from \u8868 group by num having max(id) &gt; 10\r\n \r\n    \u7279\u522b\u7684\uff1agroup by \u5fc5\u987b\u5728where\u4e4b\u540e\uff0corder by\u4e4b\u524d<\/pre>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>mysql\u7b80\u4ecb 1\u3001\u4ec0\u4e48\u662f\u6570\u636e\u5e93 \uff1f \u6570\u636e\u5e93\uff08Database\uff09\u662f\u6309\u7167\u6570\u636e\u7ed3\u6784\u6765\u7ec4\u7ec7\u3001\u5b58\u50a8\u548c\u7ba1\u7406\u6570\u636e\u7684\u4ed3\u5e93\uff0c\u5b83\u4ea7\u751f\u4e8e\u8ddd\u4eca\u516d\u5341\u591a\u5e74\u524d\uff0c\u968f\u7740\u4fe1\u606f\u6280\u672f\u548c\u5e02\u573a\u7684\u53d1\u5c55\uff0c\u7279\u522b\u662f\u4e8c\u5341\u4e16\u7eaa\u4e5d\u5341\u5e74\u4ee3\u4ee5\u540e\uff0c\u6570\u636e\u7ba1\u7406\u4e0d\u518d\u4ec5\u4ec5\u662f\u5b58\u50a8\u548c\u7ba1\u7406\u6570\u636e\uff0c\u800c\u8f6c\u53d8\u6210\u7528\u6237\u6240\u9700\u8981\u7684\u5404\u79cd\u6570\u636e\u7ba1\u7406\u7684\u65b9\u5f0f\u3002\u6570\u636e\u5e93\u6709\u5f88\u591a\u79cd\u7c7b\u578b\uff0c\u4ece\u6700\u7b80\u5355\u7684\u5b58\u50a8\u6709\u5404\u79cd\u6570\u636e\u7684\u8868\u683c\u5230\u80fd\u591f\u8fdb\u884c\u6d77\u91cf\u6570\u636e\u5b58\u50a8\u7684\u5927\u578b\u6570\u636e\u5e93\u7cfb\u7edf\u90fd\u5728\u5404\u4e2a\u65b9\u9762\u5f97\u5230\u4e86\u5e7f\u6cdb\u7684\u5e94\u7528\u3002 \u4e3b\u6d41\u7684\u6570\u636e\u5e93\u6709\uff1asqlserver\uff0cmysql\uff0cOracle\u3001SQLite\u3001Access\u3001MS SQL Server\u7b49\uff0c\u672c\u6587\u4e3b\u8981\u8bb2\u8ff0\u7684\u662fmysql 2\u3001\u6570\u636e\u5e93\u7ba1\u7406\u662f\u5e72\u4ec0\u4e48\u7528\u7684\uff1f a. \u5c06\u6570\u636e\u4fdd\u5b58\u5230\u6587\u4ef6\u6216\u5185\u5b58 b. \u63a5\u6536\u7279\u5b9a\u7684\u547d\u4ee4\uff0c\u7136\u540e\u5bf9\u6587\u4ef6\u8fdb\u884c\u76f8\u5e94\u7684\u64cd\u4f5c PS\uff1a\u5982\u679c\u6709\u4e86\u4ee5\u4e0a\u7ba1\u7406\u7cfb\u7edf\uff0c\u65e0\u987b\u81ea\u5df1\u518d\u53bb\u521b\u5efa\u6587\u4ef6\u548c\u6587\u4ef6\u5939\uff0c\u800c\u662f\u76f4\u63a5\u4f20\u9012 \u547d\u4ee4 \u7ed9\u4e0a\u8ff0\u8f6f\u4ef6\uff0c\u8ba9\u5176\u6765\u8fdb\u884c\u6587\u4ef6\u64cd\u4f5c\uff0c\u4ed6\u4eec\u7edf\u79f0\u4e3a\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff08DBMS\uff0cDatabase Management System\uff09 mysql\u5b89\u88c5 MySQL\u662f\u4e00\u79cd\u5f00\u653e\u6e90\u4ee3\u7801\u7684\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff08RDBMS\uff09\uff0cMySQL\u6570\u636e\u5e93\u7cfb\u7edf\u4f7f\u7528\u6700\u5e38\u7528\u7684\u6570\u636e\u5e93\u7ba1\u7406\u8bed\u8a00\u2013\u7ed3\u6784\u5316\u67e5\u8be2\u8bed\u8a00\uff08SQL\uff09\u8fdb\u884c\u6570\u636e\u5e93\u7ba1\u7406\u3002\u5728 WEB \u5e94\u7528\u65b9\u9762MySQL\u662f\u6700\u597d\u7684 RDBMS (Relational Database Management System\uff0c\u5173\u7cfb\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf) \u5e94\u7528\u8f6f\u4ef6\u4e4b\u4e00\u3002 \u4f7f\u7528mysql\u5fc5\u987b\u5177\u5907\u4e00\u4e0b\u6761\u4ef6 \u3000\u3000a. \u5b89\u88c5MySQL\u670d\u52a1\u7aef \u3000\u3000b. \u5b89\u88c5MySQL\u5ba2\u6237\u7aef \u3000\u3000b. \u3010\u5ba2\u6237\u7aef\u3011\u8fde\u63a5\u3010\u670d\u52a1\u7aef\u3011 \u3000\u3000c. \u3010\u5ba2\u6237\u7aef\u3011\u53d1\u9001\u547d\u4ee4\u7ed9\u3010\u670d\u52a1\u7aefMySQL\u3011\u670d\u52a1\u7684\u63a5\u53d7\u547d\u4ee4\u5e76\u6267\u884c\u76f8\u5e94\u64cd\u4f5c(\u589e\u5220\u6539\u67e5\u7b49) 1\u3001\u4e0b\u8f7d\u5730\u5740\uff1ahttp:\/\/dev.mysql.com\/downloads\/mysql\/ 2\u3001\u5b89\u88c5 windows\u5b89\u88c5\u8bf7\u53c2\u8003\uff1ahttp:\/\/www.cnblogs.com\/lonelywolfmoutain\/p\/4547115.html linux\u4e0b\u5b89\u88c5\uff1ahttp:\/\/www.cnblogs.com\/chenjunbiao\/archive\/2011\/01\/24\/1940256.html \u6ce8\uff1a\u4ee5\u4e0a\u4e24\u4e2a\u94fe\u63a5\u6709\u5b8c\u6574\u7684\u5b89\u88c5\u65b9\u5f0f\uff0c\u64b8\u4e3b\u4e5f\u662f\u53c2\u8003\u4ed6\u7684\u5b89\u88c5\u7684\uff0c\u5b89\u88c5\u5b8c\u4ee5\u540emysql.server start\u542f\u52a8mysql\u670d\u52a1 mysql\u64cd\u4f5c \u4e00\u3001\u8fde\u63a5\u6570\u636e\u5e93 mysql -u user -p \u4f8b\uff1amysql -u root -p \u5e38\u89c1\u9519\u8bef\u5982\u4e0b\uff1a ERROR 2002 &hellip; <a href=\"https:\/\/www.strongd.net\/?p=1361\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">MYSQL\u5165\u95e8\u5168\u5957<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[203],"class_list":["post-1361","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-mysql"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1361"}],"version-history":[{"count":1,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1361\/revisions"}],"predecessor-version":[{"id":1362,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1361\/revisions\/1362"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}