{"id":282,"date":"2023-06-29T14:25:31","date_gmt":"2023-06-29T05:25:31","guid":{"rendered":"http:\/\/tech.itdesk.co.kr\/?p=282"},"modified":"2023-06-29T16:38:51","modified_gmt":"2023-06-29T07:38:51","slug":"mysql-db-%ea%b4%80%eb%a0%a8-%ea%b8%b0%eb%b3%b8-%ec%bf%bc%eb%a6%ac","status":"publish","type":"post","link":"https:\/\/iwgh.duckdns.org\/?p=282","title":{"rendered":"Mysql DB \uad00\ub828 \uae30\ubcf8 \ucffc\ub9ac"},"content":{"rendered":"\n<pre class=\"wp-block-code has-small-font-size\"><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">\ud14c\uc774\ube14 \ub0b4 \uae30\ubcf8 \uc870\ud68c\n   SELECT \uceec\ub7fc\uba85, \uc9d1\uacc4\ud568\uc218 as \ubcc4\uba85   ----------------- (5)\n   FROM \ud14c\uc774\ube14\uba85                     ----------------- (1)\n   WHERE \ud14c\uc774\ube14 \uc870\uac74                 ----------------- (2)\n   GROUP BY \uceec\ub7fc\uba85                   ----------------- (3)\n   HAVING \uadf8\ub8f9 \uc870\uac74                  ----------------- (4)\n   ORDER BY \uceec\ub7fc\uba85                   ----------------- (6)\n   FROM : SQL\uc740 \uad6c\ubb38\uc774 \ub4e4\uc5b4\uc624\uba74 \ud14c\uc774\ube14\uc744 \uac00\uc7a5 \uba3c\uc800 \ud655\uc778\ud569\ub2c8\ub2e4. \ud14c\uc774\ube14\uc774 \uc5c6\ub294\ub370 \ub2e4\ub978 \uac83\ub4e4\uc744 \uba3c\uc800 \uc870\ud68c\ud558\uba74 \ud5db\uc218\uace0\ub2c8\uae4c\uc694!\n   WHERE : \ud14c\uc774\ube14\uba85\uc744 \ud655\uc778\ud588\uc73c\ub2c8, \ud14c\uc774\ube14\uc5d0\uc11c \uc8fc\uc5b4\uc9c4 \uc870\uac74\uc5d0 \ub9de\ub294 \ub370\uc774\ud130\ub4e4\uc744 \ucd94\ucd9c\ud574\uc90d\ub2c8\ub2e4.\n   GROUP BY : \uc870\uac74\uc5d0 \ub9de\ub294 \ub370\uc774\ud130\uac00 \ucd94\ucd9c\ub418\uc5c8\uc73c\ub2c8, \uacf5\ud1b5\uc801\uc778 \ub370\uc774\ud130\ub4e4\ub07c\ub9ac \ubb36\uc5b4 \uadf8\ub8f9\uc744 \ub9cc\ub4e4\uc5b4\uc90d\ub2c8\ub2e4.\n   HAVING : \uacf5\ud1b5\uc801\uc778 \ub370\uc774\ud130\ub4e4\uc774 \ubb36\uc5ec\uc9c4 \uadf8\ub8f9 \uc911, \uc8fc\uc5b4\uc9c4 \uc8fc\uac74\uc5d0 \ub9de\ub294 \uadf8\ub8f9\ub4e4\uc744 \ucd94\ucd9c\ud574\uc90d\ub2c8\ub2e4.\n   SELECT : \ucd5c\uc885\uc801\uc73c\ub85c \ucd94\ucd9c\ub41c \ub370\uc774\ud130\ub4e4\uc744 (\ub610 \ud568\uc218\ub85c \ubb36\uc5b4 \uacc4\uc0b0\uacb0\uacfc\ub97c) \uc870\ud68c\ud569\ub2c8\ub2e4.\n   ORDER BY : \ucd94\ucd9c\ub41c \ub370\uc774\ud130\ub4e4\uc744 \uc815\ub82c\ud574\uc90d\ub2c8\ub2e4.\n\n** \uc811\uc18d\uba85\ub839\uc5b4 : mysql\n\tmysql -u user-name -p password \uc591\uc2dd\uc73c\ub85c \uc811\uc18d\uac00\ub2a5.\n\tOS\ub530\ub77c \"mysql -uuser-name -ppassword\" \uc774\ub807\uac8c \ubd99\uc5ec\uc57c \ub418\ub294 \uac83\ub3c4 \uc788\uc74c.\n\t\uadf8\ubc16\uc5d0 \uc635\uc158 \n\t-h localhost \uc811\uc18d\ud560 \ud638\uc2a4\ud2b8\uc9c0\uc815.\n\t mysql &#91;options] db_name ; \ub9c8\uc9c0\ub9c9\uc5d0 DB\uc774\ub984\uc744 \ub123\uc5b4 \uc811\uc18d\uac00\ub2a5.\n\n** mysql> DB query \ubb38\n\t-database \ubaa9\ub85d \ud655\uc778\n\tmysql> show database;\n\t\n\t-\uc0ac\uc6a9\uc790 \ucd94\uac00\/\uad8c\ud55c\ubd80\uc5ec\n\tmysql> create user 'test'@'localhost' identified by 'test1234';\n\tmysql> grant all privileges on test_database.* to test@'localhost';\n\tmysql> grant all privileges on test_database.* to test_grant@'%' identified by 'test1234';\n\t-> grant\ub97c \uc0ac\uc6a9\ud574 user\ucd94\uac00 \ubc0f \uad8c\ud55c\ubd80\uc5ec, %\uc0ac\uc6a9\uc2dc \uc678\ubd80\uc811\uc18d\uac00\ub2a5.\n\n\t-user \ud655\uc778\n\tmysql> use mysql;  -> \ub300\ubd80\ubd84\uc758 \uc2dc\uc2a4\ud15c\uc815\ubcf4\ub294 mysql \ub370\uc774\ud130\ubca0\uc774\uc2a4\uc5d0 \uc788\uc74c.\n\tmysql> select user, host from user;  -> user table\uc5d0\uc11c username,host\uc815\ubcf4\n\t\n\t-password \ubcc0\uacbd\n\tmysql> use mysql; \n\tmysql> alter user 'zabbix'@'localhost' identified by 'Hazel123!@';\n\tmysql> FLUSH PRIVILEGES;\n\t\n\t-user \uc0ad\uc81c\n\t drop user username@host_name;\n\t\n\t-\uae30\ubcf8 query\n\tmysql> use database_name;  -> \ub370\uc774\ud130\ubca0\uc774\uc2a4 \ubcc0\uacbd\n\tmysql> show talbes;            -> table\ubaa9\ub85d \ud655\uc778\n\tmysql> select database();      -> \ud604\uc7ac \ub370\uc774\ud130\ubca0\uc774\uc2a4 \ud655\uc778\n\tmysql> desc \ud14c\uc774\ube14\uc774\ub984;      -> \ud14c\uc774\ube14\uc758 scheme\uc815\ubcf4 \ud655\uc778\n        mysql> show columns from \ud14c\uc774\ube14\uc774\ub984;    -> \ud14c\uc774\ube14\ub0b4 \ucf5c\ub86c \uc870\ud68c<\/mark><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":93,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,60,59],"class_list":["post-282","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-mysql","tag-password-reset","tag-user"],"_links":{"self":[{"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/posts\/282","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=282"}],"version-history":[{"count":2,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/posts\/282\/revisions"}],"predecessor-version":[{"id":284,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/posts\/282\/revisions\/284"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=\/wp\/v2\/media\/93"}],"wp:attachment":[{"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=282"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=282"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iwgh.duckdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=282"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}