{"id":4532,"date":"2021-07-08T10:29:39","date_gmt":"2021-07-08T01:29:39","guid":{"rendered":"\/blog\/?p=4532"},"modified":"2024-01-19T10:31:56","modified_gmt":"2024-01-19T01:31:56","slug":"mysql-root-%ed%8c%a8%ec%8a%a4%ec%9b%8c%eb%93%9c-%eb%b3%80%ea%b2%bd-%eb%b0%8f-%ec%9b%90%ea%b2%a9-%ec%a0%91%ec%86%8d-%ea%b6%8c%ed%95%9c","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=4532","title":{"rendered":"[MySQL] \uc0ac\uc6a9\uc790 \ubc0f \uc6d0\uaca9\uc811\uc18d \uad8c\ud55c \uad00\ub9ac"},"content":{"rendered":"\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"sql\" data-enlighter-theme=\"atomic\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">--1. \uc0ac\uc6a9\uc790 \uc870\ud68c\n    SELECT user, host FROM mysql.user;\n\n--2. \uc0ac\uc6a9\uc790 \uc0ad\uc81c\n    DROP mysql.user '\uacc4\uc815\uba85'@'192.168.%';\n    DROP mysql.user '\uacc4\uc815\uba85'@'%';\n\n--3. root \ud328\uc2a4\uc6cc\ub4dc \ubcc0\uacbd\n  --\u25a0MySQL 8.0 (root \ub85c\uceec \ubc0f \uc6d0\uaca9 \ud328\uc2a4\uc6cc\ub4dc \ubcc0\uacbd)\n    ALTER user 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'passwd88';\n    ALTER user 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'passwd88';\n\n    --\uc6d0\uaca9 \uc0ac\uc6a9\uc790\ub97c \uc0dd\uc131\ud558\uace0 \uad8c\ud55c \ubd80\uc5ec\n    CREATE USER 'root'@'%' IDENTIFIED BY 'passwd88';\n    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';\n    FLUSH PRIVILEGES;\n\n  --\u25a0MariaDB 10.4 \uc774\ud558\n    mysqladmin -u root -p password 'passwd88'\n\n--4. \uc6d0\uaca9 \uc0ac\uc6a9\uc790 \uc0dd\uc131\n  --\u25a0MariaDB 10.4, MySQL 8.0 \uc774\uc0c1\n    --OS \uacc4\uc815 root\ub9cc MySQL\uc758 root \uc5d0 \uc811\uc18d\ud560 \uad8c\ud55c\uc774 \uc788\ub2e4. \uc544\ub798 \ucffc\ub9ac\ub294 \uc6d0\uaca9 \uc0ac\uc6a9\uc790\ub97c \uc0dd\uc131\ud558\uace0 \uad8c\ud55c\uc744 \ubd80\uc5ec\ud55c\ub2e4.\n\n    CREATE USER 'root'@'%' identified by 'passwd88';\n    GRANT ALL PRIVILEGES ON *.* to 'root'@'%';\n\n    CREATE USER 'root'@'127.0.0.1' identified by 'passwd88';\n    GRANT ALL PRIVILEGES ON *.* to 'root'@'127.0.0.1';\n\n    FLUSH PRIVILEGES;\n\n--5. \uc6d0\uaca9 \uc811\uc18d \uad8c\ud55c \ud655\uc778\n  SHOW GRANTS FOR 'mysql'@'localhost';\n  SELECT USER, HOST, File_priv FROM mysql.user;\n\n--6. \uc6d0\uaca9 \uc811\uc18d \uad8c\ud55c \uc81c\uac70\n  REVOKE DELETE ON MODOOS.* FROM testuser;\n  REVOKE FILE ON *.* FROM 'mysql'@'localhost';\n  DELETE FROM user WHERE USER='testuser' AND HOST='%';\n  DELETE FROM user WHERE USER='testuser' AND HOST='10.1.2.51';\n\n--7. \uc6d0\uaca9 \uc811\uc18d \uad8c\ud55c \uc8fc\uae30 (MySQL 8.x)\n  CREATE USER gateone@'127.0.0.1' IDENTIFIED BY 'passwd88';\n  GRANT ALL PRIVILEGES ON MODOOS.* TO gateone@'%';\n\n--8. \uc6d0\uaca9 \uc811\uc18d \uad8c\ud55c \uc8fc\uae30 (MariaDB 10.x)\n  GRANT ALL PRIVILEGES ON MODOOS.* TO 'gateone'@'%' IDENTIFIED BY 'passwd88';\n  GRANT ALL PRIVILEGES ON MODOOS.* TO 'gateone'@'10.1.2.%' IDENTIFIED BY 'passwd88';\n\n--9. root \uacc4\uc815 \ud328\uc2a4\uc6cc\ub4dc \uc5c6\uc560\uae30\n  SET PASSWORD FOR root@localhost=PASSWORD('');\n\n--10. DBNAME DB\uc758 \ud2b9\uc815 \uad8c\ud55c\ub9cc \ud5c8\uc6a9\n  GRANT SELECT ON DBNAME.* TO 'testuser'@'10.1.1.80' IDENTIFIED BY 'passwd88';\n  GRANT ALTER,CREATE,DELETE,DROP,INDEX,INSERT,SELECT,UPDATE ON *.* TO 'testuser'@'10.1.2.51' IDENTIFIED BY 'passwd88';\n\n--11. WITH GRANT OPTION : \ub2e4\ub978 \uc0ac\uc6a9\uc790\uc5d0\uac8c GRANT \uac00\ub2a5\n  GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'passwd88' WITH GRANT OPTION;\n\n--12. \uc801\uc6a9\nFLUSH PRIVILEGES;<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[10],"tags":[],"class_list":["post-4532","post","type-post","status-publish","format-standard","hentry","category-computing_database"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4532"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4532\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}