{"id":164,"date":"2012-07-04T18:29:02","date_gmt":"2012-07-04T12:29:02","guid":{"rendered":"http:\/\/alexeyka.zantsev.com\/?p=164"},"modified":"2012-07-04T18:29:02","modified_gmt":"2012-07-04T12:29:02","slug":"mysql-%d0%bc%d0%b5%d0%bd%d1%8f%d0%b5%d0%bc-%d1%82%d0%b8%d0%bf-%d1%81%d1%82%d0%be%d0%bb%d0%b1%d1%86%d0%b0-%d0%bf%d0%b5%d1%80%d0%b5%d0%b8%d0%bc%d0%b5%d0%bd%d0%be%d0%b2%d1%8b%d0%b2%d0%b0%d0%b5%d0%bc","status":"publish","type":"post","link":"https:\/\/alexeyka.zantsev.com\/?p=164","title":{"rendered":"MySQL: \u043c\u0435\u043d\u044f\u0435\u043c \u0442\u0438\u043f \u0441\u0442\u043e\u043b\u0431\u0446\u0430, \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u0434\u0440."},"content":{"rendered":"<div>\n<p><strong>\u041c\u0435\u043d\u044f\u0435\u043c \u0442\u0438\u043f \u0441\u0442\u043e\u043b\u0431\u0446\u0430<\/strong> \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u201cip\u201d \u043d\u0430 VARCHAR(20) (\u0431\u044b\u043b INT):<\/p>\n<blockquote><p>mysql&gt; ALTER TABLE ubuntu_users MODIFY ip VARCHAR(20);<\/p><\/blockquote>\n<p>\u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0411\u0414 (mysql&gt; use dbname;), \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u201cubuntu_users\u201d.<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0442\u0443\u0442: <a href=\"http:\/\/mysqlru.com\/reference\/data-definition\/alter-table.html\" target=\"_blank\">http:\/\/mysqlru.com\/reference\/data-definition\/alter-table.html<\/a><\/p>\n<p>\u041e \u0442\u0438\u043f\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0443\u0442 <a href=\"http:\/\/mysqlru.com\/reference\/column-types.html\" target=\"_blank\">http:\/\/mysqlru.com\/reference\/column-types.html<\/a><\/p>\n<p>===============================<\/p>\n<p><strong>\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443<\/strong> \u0438\u0437 ubuntu_users\u00a0 \u0432 ubuntu_victims:<\/p>\n<blockquote><p>mysql&gt; ALTER TABLE ubuntu_users RENAME ubuntu_victims;<\/p><\/blockquote>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0442\u0443\u0442 <a href=\"http:\/\/mysqlru.com\/reference\/data-definition\/rename-table.html\" target=\"_blank\">http:\/\/mysqlru.com\/reference\/data-definition\/rename-table.html<\/a><\/p>\n<p>===============================<\/p>\n<p><strong>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u043e\u043b\u0431\u0435\u0446<\/strong> \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u201ccomment\u201d \u0438 \u0442\u0438\u043f\u043e\u043c VARCHAR(50)\u00a0:<\/p>\n<blockquote><p>mysql&gt; ALTER TABLE ubuntu_users ADD comment VARCHAR(50);<\/p><\/blockquote>\n<p>===============================<\/p>\n<p><strong>\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0441\u0442\u043e\u043b\u0431\u0435\u0446<\/strong> \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u201ccomment\u201d:<\/p>\n<blockquote><p>mysql&gt; ALTER TABLE ubuntu_users DROP COLUMN comment;<\/p><\/blockquote>\n<p>===============================<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0447\u0438\u0441\u043b\u043e\u0432\u043e\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 <code>AUTO_INCREMENT<\/code> \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>\"count\":<\/code><\/p>\n<blockquote><p>mysql&gt; ALTER TABLE ubuntu_users ADD count INT UNSIGNED NOT NULL AUTO_INCREMENT, ADD INDEX (comment);<\/p><\/blockquote>\n<p>\u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u0447\u0442\u043e \u0441\u0442\u043e\u043b\u0431\u0435\u0446 <code>\"comment\"<\/code> \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u043e\u043b\u0431\u0446\u044b <code>AUTO_INCREMENT<\/code> \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u044b, \u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0441\u0442\u043e\u043b\u0431\u0435\u0446 <code>\"comment\"<\/code> \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u043a <code>NOT NULL<\/code>, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u043e\u043b\u0431\u0446\u044b \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c <code>NULL<\/code>.<\/p>\n<p>\u041f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 <code>AUTO_INCREMENT<\/code> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043d\u043e\u043c\u0435\u0440\u0430\u043c\u0438 (\u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439).<\/p>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0435 SET: <a href=\"http:\/\/mysqlru.com\/mysql-optimisation\/optimising-the-server\/set-option.html\" target=\"_blank\">http:\/\/mysqlru.com\/mysql-optimisation\/optimising-the-server\/set-option.html<\/a><\/p>\n<p>==============================<\/p>\n<p><strong>\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u0411\u0414<\/strong>:<\/p>\n<blockquote><p>mysql&gt; DROP DATABASE dbname;<\/p><\/blockquote>\n<p><a href=\"http:\/\/mysqlru.com\/reference\/data-definition\/drop-database.html\" target=\"_blank\">http:\/\/mysqlru.com\/reference\/data-definition\/drop-database.html<\/a><\/p>\n<p>===============================<\/p>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e<\/strong> \u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430\u0445 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u201cubuntu_users\u201d:<\/p>\n<blockquote><p>mysql&gt; DESCRIBE ubuntu_users;<\/p><\/blockquote>\n<p>===============================<\/p>\n<blockquote><p><strong>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\u00a0:<\/strong><br \/>\nmysql&gt; ALTER TABLE ubuntu_users MODIFY comment varchar Default \u2018this is comment\u2019;<\/p><\/blockquote>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u041c\u0435\u043d\u044f\u0435\u043c \u0442\u0438\u043f \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u201cip\u201d \u043d\u0430 VARCHAR(20) (\u0431\u044b\u043b INT): mysql&gt; ALTER TABLE ubuntu_users MODIFY ip VARCHAR(20); \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0411\u0414 (mysql&gt; use dbname;), \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u201cubuntu_users\u201d. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0442\u0443\u0442: http:\/\/mysqlru.com\/reference\/data-definition\/alter-table.html \u041e \u0442\u0438\u043f\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0438\u0442\u0430\u0442\u044c \u0442\u0443\u0442 http:\/\/mysqlru.com\/reference\/column-types.html =============================== \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438\u0437 ubuntu_users\u00a0 \u0432 ubuntu_victims: mysql&gt; ALTER TABLE ubuntu_users RENAME ubuntu_victims; \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0442\u0443\u0442 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[80],"class_list":["post-164","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-mysql"],"_links":{"self":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=164"}],"version-history":[{"count":1,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/164\/revisions"}],"predecessor-version":[{"id":165,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/164\/revisions\/165"}],"wp:attachment":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}