์์ฃผ ์ฌ์ฉํ๋ ๋ช ๋ น์ด๋ ๊ธฐ๋กํ๋ฉด์ ์ ์ฐจ ์ต์ํด์ ธ์ผ๊ฒ ๋ค โ
-
๋จผ์ MySQL ์ ์
mysql -u root -p
-
๊ณ์ ์ ํ์ฌ ์์ฑ๋ ์ฌ์ฉ์ ๊ณ์ ์ฒดํฌ
-
use mysql;
-
select host, user from user;
-
-
์ฌ์ฉ์ ์ถ๊ฐ
-
create user <user_id>;
-
create user <user_id>@localhost identified by <password>;
: password๊น์ง ์ค์ โ ์ธ๋ถ ์ ๊ทผ ๊ถํ์ ๋ถ์ฌํ๋ ค๋ฉด, host๋ถ๋ถ์ '%'๋ก ํด์ ๋๊ฐ์ ๊ณ์ ์ถ๊ฐํด์ผ ํจ
-
-
์ธ๋ถ ์ ๊ทผ ๊ฐ๋ฅํ user_id ๊ณ์ ์ญ์
drop user <user_id>@'%';
-
root ๊ณ์ ์ ๋น๋ฐ๋ฒํธ ์์
-
alter user root@localhost identified with mysql_native_password by <password>;
: root ๊ณ์ ๋น๋ฐ๋ฒํธ ๋ณ๊ฒฝ -
์ฃผ์ 1. ์ค์ ํ password ์ ์ฑ ์ ๋ฐ๋ผ password๋ฅผ ์ ๋ ฅํด์ผ ํจ โโ
-
์ฃผ์ 2. ๋ณ๊ฒฝ ํ, ๋ณ๊ฒฝ๋ ๋ด์ฉ์ ๋ฉ๋ชจ๋ฆฌ์ ๋ฐ์ํ๋
flush privileges;
๋ฅผ ์ ๋ ฅํด์ผ ํจ
-
-
๋ชจ๋ ์๊ฒฉ์ง์์ ์ ์ ๊ถํ ์ถ๊ฐ
grant all pribileges on <DB_name>.* to <user_id>@'%' identified by <password>;
-
ํด๋น ์ฌ์ฉ์์๊ฒ ๋ชจ๋ ๋ฐ์ดํฐ๋ฒ ์ด์ค ๋ชจ๋ ํ ์ด๋ธ์ ๊ถํ ๋ถ์ฌ
grant all privileges on *.* to <user_id>@'%' identified by <password> with grant option;
-
๊ถํ ํ์ธ
-
show grants for <user_id>@localhost;
-
show grants for <user_id>@'%';
-
-
๋ณ๊ฒฝ๋ ๋ด์ฉ์ ๋ฉ๋ชจ๋ฆฌ์ ๋ฐ์ํ๊ธฐ ์ํด ํด๋น ๋ช ๋ น์ด ์ฌ์ฉ
flush privileges;
โฐ ํด๋น ๋ช ๋ น์ด๋ ์ฑ๋ฅ์ ์ํฅ์ ์ค๋ค๊ณ ํจ. ์ต๊ด์ ์ผ๋ก ํด๋น ๋ช ๋ น์ด๋ฅผ ํตํด reload ํ๋ ๊ฒฝ์ฐ๊ฐ ์๋ค๊ณ ํ๋๋ฐ ์ด๋ ์์ฒญ๋ ๋ถํ๊ฐ ๋๋ค๊ณ ํจ
- ๋ฒ์ ๋ณ ์กฐ๊ธ ์ฐจ์ด ์์ ๐ ๋ค๋ฅธ์ฌ๋์ ๋ธ๋ก๊ทธ ์ฐธ๊ณ