{"id":187,"date":"2012-07-09T13:46:35","date_gmt":"2012-07-09T07:46:35","guid":{"rendered":"http:\/\/alexeyka.zantsev.com\/?p=187"},"modified":"2015-05-07T18:21:34","modified_gmt":"2015-05-07T12:21:34","slug":"mysql-%d1%81%d0%bc%d0%be%d1%82%d1%80%d0%b8%d0%bc-%d1%81%d0%bf%d0%b8%d1%81%d0%be%d0%ba-%d0%bf%d0%be%d0%bb%d1%8c%d0%b7%d0%be%d0%b2%d0%b0%d1%82%d0%b5%d0%bb%d0%b5%d0%b9","status":"publish","type":"post","link":"https:\/\/alexeyka.zantsev.com\/?p=187","title":{"rendered":"MySQL: \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439"},"content":{"rendered":"<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 <strong>mysql<\/strong> \u043f\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c <strong>root<\/strong> , \u0432 \u0431\u0430\u0437\u0443 <em>mysql<\/em>:<\/p>\n<blockquote><p>mysql -u root -p mysql<\/p><\/blockquote>\n<p>\u0418 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445 (\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043e\u043d\u0430, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0432 \u0431\u0430\u0437\u0435 \u043f\u043e\u0434 \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c &#8220;mysql&#8221;, \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 &#8220;user&#8221;):<\/p>\n<blockquote><p>mysql&gt; select * from user;<\/p><\/blockquote>\n<p>\u042d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0443\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043b\u043e\u043d\u043e\u043a \u044d\u0442\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b:<\/p>\n<blockquote><p>mysql&gt; describe user;<\/p><\/blockquote>\n<p>&#8230; \u0430 \u043f\u043e\u0442\u043e\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u043c \u043d\u0430\u0441 \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c:<\/p>\n<blockquote>\n<pre><span style=\"font-size: medium;\">mysql&gt; select host,user from user;\r\n+-----------+------------------+\r\n| host\u00a0\u00a0\u00a0\u00a0\u00a0 | user\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\r\n+-----------+------------------+\r\n| 127.0.0.1 | root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\r\n| lexus\u00a0\u00a0\u00a0\u00a0 | root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\r\n| localhost | debian-sys-maint |\r\n| localhost | root\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 |\r\n+-----------+------------------+\r\n4 rows in set (0.00 sec)<\/span><\/pre>\n<\/blockquote>\n<p>Creating user petrov_ak, who will connect from anywhere (%):<\/p>\n<pre>\r\nmysql> CREATE USER 'petrov_ak'@'%' IDENTIFIED BY 'pAsSwOrD';\r\nQuery OK, 0 rows affected (0.00 sec)\r\n<\/pre>\n<p>Grant privileges. Let him SELECT only from DB &#8216;asterisk&#8217;, table &#8216;cdr&#8217;:<\/p>\n<pre>\r\nmysql> GRANT SELECT ON asterisk.cdr TO 'petrov_ak'@'%';\r\nQuery OK, 0 rows affected (0.00 sec)\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 mysql \u043f\u043e\u0434 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c root , \u0432 \u0431\u0430\u0437\u0443 mysql: mysql -u root -p mysql \u0418 \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u0445 (\u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043e\u043d\u0430, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0432 \u0431\u0430\u0437\u0435 \u043f\u043e\u0434 \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u044b\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c &#8220;mysql&#8221;, \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 &#8220;user&#8221;): mysql&gt; select * from user; \u042d\u0442\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u044b\u0432\u0435\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0435\u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0443\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c [&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":[9,80],"class_list":["post-187","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-linux","tag-mysql"],"_links":{"self":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/187","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=187"}],"version-history":[{"count":13,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/187\/revisions"}],"predecessor-version":[{"id":832,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/187\/revisions\/832"}],"wp:attachment":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}