{"id":159,"date":"2009-11-03T11:37:07","date_gmt":"2009-11-03T03:37:07","guid":{"rendered":"http:\/\/sashakrasnoyarsk.ru\/?p=159"},"modified":"2010-02-11T16:41:29","modified_gmt":"2010-02-11T09:41:29","slug":"%d0%b1%d0%be%d1%8f%d0%bd%d1%8b-%d0%bd%d0%b0-%d0%bf%d0%b0%d0%bc%d1%8f%d1%82%d1%8c-%d1%80%d0%b0%d0%b1%d0%be%d1%82%d0%b0-%d1%81-mysql","status":"publish","type":"post","link":"https:\/\/sashakrasnoyarsk.ru\/?p=159","title":{"rendered":"\u0411\u043e\u044f\u043d\u044b \u043d\u0430 \u043f\u0430\u043c\u044f\u0442\u044c: \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 MySQL."},"content":{"rendered":"<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a \u043d\u0430\u0431\u043e\u0440 \u0445\u0438\u043d\u0442\u043e\u0432 \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437&#8230;<\/p>\n<p>1. \u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0431\u0430\u0437.<\/p>\n<p>mysqlshow -u USERNAME -pPASSWORD<!--more--><\/p>\n<p>\u0412\u0410\u0416\u041d\u041e! \u043c\u0435\u0436\u0434\u0443 &#171;-u&#187; \u0438 &#171;USERNAME&#187; \u043f\u0440\u043e\u0431\u0435\u043b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0430 \u043c\u0435\u0436\u0434\u0443 &#171;-p&#187; \u0438 &#171;PASSWORD&#187; \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432!<\/p>\n<p>\u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u043e\u043a\u0430\u0436\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0438\u043c\u0435\u044e\u0449\u0438\u0445\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0431\u0430\u0437.<\/p>\n<p>mysqlshow -u USERNAME -pPASSWORD DATABASENAME<\/p>\n<p>mysqlshow -u USERNAME -pPASSWORD DATABASENAME TABLENAME<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435 \u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0440\u0435\u0431\u0443\u044e\u0442 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u043a\u0430\u0437\u0430\u0432 -p, \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043e\u0437\u043d\u0430\u0447\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0430\u0440\u043e\u043b\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0432\u0435\u0441\u0442\u0438 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u0411\u0443\u0434\u0443\u0442 \u0432\u044b\u0432\u0435\u0434\u0435\u043d \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u0432\u043e\u0434 \u043f\u0430\u0440\u043e\u043b\u044f.<\/p>\n<p>2. \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a \u0411\u0414.<\/p>\n<p>mysql -u USERNAME -pPASSWORD<\/p>\n<p>3. \u0417\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435.<\/p>\n<p>mysql&gt; create user USERNAME@HOST;<\/p>\n<p>\u0412\u0410\u0416\u041d\u041e! \u041d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c (\u0441\u043c. \u043f.2.) &#171;mysql&gt; &#187; \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u044d\u0442\u043e \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u0442 mysql.<\/p>\n<p>HOST \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0430\u043a\u0438\u043c:<\/p>\n<p>localhost &#8212; \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u0411\u0414.<\/p>\n<p>% &#8212; \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430.<\/p>\n<p>\u0418\u041c\u042f_\u0425\u041e\u0421\u0422\u0410 &#8212; \u0434\u043b\u044f \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u043d\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430.<\/p>\n<p>4. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0430\u0440\u043e\u043b\u044f \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f.<\/p>\n<p>mysql&gt; set password for USERNAME@HOST = password(&#8216;PASSWORD&#8217;);<\/p>\n<p>5. \u0420\u0430\u0437\u0434\u0430\u0447\u0430 \u043f\u0440\u0430\u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e mysql.<\/p>\n<p>mysql&gt; connect DATABASE;<\/p>\n<p>mysql&gt; grant PRIVILEGELIST on *.* to USERNAME@HOST;<\/p>\n<p>6. \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>mysql&gt; alter table TABLE change OLD_COLUMN_NAME NEW_COLUMN_NAME COLUMN_TYPE;<\/p>\n<p>\u041c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0438\u0437 &#171;OLD_COLUMN_NAME&#187; \u0432 &#171;NEW_COLUMN_NAME&#187; \u0438\u043b\u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0442\u0438\u043f \u043d\u0430 &#171;COLUMN_TYPE&#187;.<\/p>\n<p>7. \u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>mysql&gt; select CONUMN_NAME1[, COLUMN_NAME2[, &#8230;]] from TABLE where EXPRESSION;<\/p>\n<p>mysql&gt; select * from TABLE where EXPRESSION;<\/p>\n<p>8. \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/p>\n<p>mysql&gt; update TABLE set COLUMN_NAME1 = VALUE1[, COLUMN_NAME1 = VALUE1[, &#8230;]] where EXPRESSION;<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 EXPRESSION \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 TRUE \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438\u043b\u0438 FALSE \u0434\u043b\u044f \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0445. \u041f\u0440\u0438\u043c\u0435\u0440: where username like &#8216;edward%&#8217;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u043a \u043d\u0430\u0431\u043e\u0440 \u0445\u0438\u043d\u0442\u043e\u0432 \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0438\u0441\u043a\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437&#8230; 1. \u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0431\u0430\u0437. mysqlshow -u USERNAME -pPASSWORD<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,143],"tags":[144,1549,63,145,148,147,146],"class_list":["post-159","post","type-post","status-publish","format-standard","hentry","category-boyany","category-database","tag-create","tag-database","tag-mysql","tag-user","tag-148","tag-147","tag-146"],"_links":{"self":[{"href":"https:\/\/sashakrasnoyarsk.ru\/index.php?rest_route=\/wp\/v2\/posts\/159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sashakrasnoyarsk.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sashakrasnoyarsk.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sashakrasnoyarsk.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sashakrasnoyarsk.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=159"}],"version-history":[{"count":7,"href":"https:\/\/sashakrasnoyarsk.ru\/index.php?rest_route=\/wp\/v2\/posts\/159\/revisions"}],"predecessor-version":[{"id":161,"href":"https:\/\/sashakrasnoyarsk.ru\/index.php?rest_route=\/wp\/v2\/posts\/159\/revisions\/161"}],"wp:attachment":[{"href":"https:\/\/sashakrasnoyarsk.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sashakrasnoyarsk.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sashakrasnoyarsk.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}