๐Ÿณ ์˜ค๋ฅ˜: 'db:create' ์‹คํ–‰ ์‹œ 'ํ”Œ๋Ÿฌ๊ทธ์ธ ์บ์‹ฑ_sha2_password๋ฅผ ๋กœ๋“œํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค'

3557 ๋‹จ์–ด mysqlrailsdocker

๐Ÿค” ๋ฌธ์ œ



์˜ค๋ฅ˜: 'ํ”Œ๋Ÿฌ๊ทธ์ธ caching_sha2_password๋ฅผ ๋กœ๋“œํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค'

๐Ÿ˜† ์†”๋ฃจ์…˜



IDENTIFIED๋ฅผ mysql_native_password๋กœ ๋ณ€๊ฒฝ

๐Ÿ‘Œ์ ˆ์ฐจ



1.




$ docker cp hoge.sql [cotaier-id]:/hoge.sql

2. ๋„์ปค์— ๋กœ๊ทธ์ธ



$ docker ps
$ docker exec -it [container-id] /bin/bash

3. MySQL์— ๋กœ๊ทธ์ธ



$ mysql -u root -p

4. ๋ฃจํŠธ ์‚ฌ์šฉ์ž๋ฅผ ํ™•์ธํ•˜๊ณ  ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.



๋น„๋ฐ€๋ฒˆํ˜ธ๋Š” 'password'๋ผ๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค.

mysql> SELECT user, host, plugin FROM mysql.user;
+------------------+-----------+-----------------------+
| user             | host      | plugin                |
+------------------+-----------+-----------------------+
| root             | %         | caching_sha2_password |
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session    | localhost | caching_sha2_password |
| mysql.sys        | localhost | caching_sha2_password |
| root             | localhost | caching_sha2_password |
+------------------+-----------+-----------------------+
5 rows in set (0.00 sec)

mysql> alter user 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> alter user 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT user, host, plugin FROM mysql.user;
+------------------+-----------+-----------------------+
| user             | host      | plugin                |
+------------------+-----------+-----------------------+
| root             | %         | mysql_native_password |
| mysql.infoschema | localhost | caching_sha2_password |
| mysql.session    | localhost | caching_sha2_password |
| mysql.sys        | localhost | caching_sha2_password |
| root             | localhost | mysql_native_password |
+------------------+-----------+-----------------------+
5 rows in set (0.00 sec)


๋ถ€๋ชจ ์ฐธ๊ณ  ์‚ฌํ•ญ




์ข‹์€ ์›นํŽ˜์ด์ง€ ์ฆ๊ฒจ์ฐพ๊ธฐ