¿äÁò ansible ·Î MySQL ÇÁ·ÎºñÀú´× ½ºÅ©¸³Æ®¸¦ Â¥°í ÀÖ½À´Ï´Ù. ±âÁ¸ ÀÛ¼ºµÇ¾î ÀÖ´ø MariaDB ½ºÅ©¸³Æ®¸¦ Âü°íÇؼ ÀÛ¼º ÁßÀε¥ MySQL ¿¡¼´Â µ¿ÀÛÇÏÁö ¾Ê´Â ºÎºÐÀÌ Á» ÀÖ¾ú½À´Ï´Ù. ¾Æ¹«·¡µµ µÑÀÌ ºñ½ÁÇÏ´Ù°í´Â Çصµ °¢ÀÚ ¹öÀü ¾÷ÀÌ °è¼Ó µÇ¸é¼ Â÷ÀÌÁ¡ÀÌ »ý±ä °Í °°½À´Ï´Ù. À̹ø Æ÷½ºÆÿ¡¼´Â Unix/Linux ½Ã½ºÅÛ¿¡ ¹ÙÀ̳ʸ® ÆÄÀÏÀ» ÀÌ¿ëÇؼ ¼³Ä¡ÇÒ °æ¿ì, MySQL 5.7 ¹öÀüºÎÅÍ ¹Ù²ï ¼³Ä¡ ¹æ¹ýÀ» »ìÆ캸°Ú½À´Ï´Ù.
Binary package MySQL Installation Layout for Generic Unix/Linux Binary Package
bin : mysqld server, Ŭ¶óÀ̾ðÆ®, À¯Æ¿¸®Æ¼ ÇÁ·Î±×·¥ µîdocs : MySQL ¸Þ´º¾óinclude : Include (header) ÆÄÀÏlib : ¶óÀ̺귯¸®man : Unix ¸Þ´º¾ó ÆäÀÌÁöshare : ¿¡·¯¸Þ½ÃÁö, µñ¼Å³Ê¸®, database ¼³Ä¡ SQLsupport-files : ±âŸ ÆÄÀÏMySQL 5.6 ÀÌÇÏ MySQL 5.6 ÀÌÇϳª MariaDB °°Àº °æ¿ì mysql_install_db
¶ó´Â ½ºÅ©¸³Æ®¸¦ ÀÌ¿ëÇؼ ¼³Ä¡Çß½À´Ï´Ù.
1 2 3 $ scripts/mysql_install_db --user=mysql $ bin/mysqld_safe --user=mysql & $ cp support-files/mysql.server /etc/init.d/mysql.server
MySQL 5.7 ÀÌ»ó ÇÏÁö¸¸ mysql_isntall_db
°¡ deprecated µÇ¸é¼ »ç¿ë ½Ã ¿¡·¯°¡ ¹ß»ýÇÕ´Ï´Ù.
MySQL 5.7.6 deprecates the mysql_install_db command and introduces a mysqld --initialize command as a replacement.[1]
´ë½Å mysqld ÀÇ --initialize
¶ó´Â Ä¿¸Çµå¸¦ ÀÌ¿ëÇؼ ÃʱâÈ ¹× ¼³Ä¡¸¦ ÇؾßÇÕ´Ï´Ù.
1 2 3 4 $ bin/mysqld --initialize --user=mysql $ bin/mysql_ssl_rsa_setup $ bin/mysqld_safe --user=mysql & $ cp support-files/mysql.server /etc/init.d/mysql.server
–initialize À§ ¹æ¹ýÀ¸·Î ¼³Ä¡ÇÒ °æ¿ì, Àӽà ºñ¹Ð¹øÈ£°¡ ¹ß±ÞµË´Ï´Ù. À̸¦ ÀÌ¿ëÇؼ óÀ½ Á¢¼ÓÀÌ °¡´ÉÇÏ°í, Á¢¼Ó ÈÄ¿¡ ·çÆ® ºñ¹Ð¹øÈ£¸¦ º¯°æÇÏ¸é µË´Ï´Ù.
1 2018-04-26T07:11:50.371426Z 1 [Note] A temporary password is generated for root@localhost: IL0E:rfYAtwy
1 $ /MySQL/mysql-5.7.21/bin/mysql -uroot -pIL0E:rfYAtwy
–initialize-insecure ±×·±µ¥ ¼³Ä¡ ½ºÅ©¸³Æ®¿¡¼´Â ÀÌ·± ÀÛ¾÷ÀÌ ½±Áö°¡ ¾Ê½À´Ï´Ù. ÀÌ·² ¶© Àӽà ºñ¹Ð¹øÈ£ ¾øÀÌ Á¢¼ÓÇÒ ¼ö ÀÖµµ·Ï ¼³Ä¡ÇÏ´Â ¹æ¹ýÀÌ ÀÖ½À´Ï´Ù.
1 $ bin/mysqld --initialize-insecure --user=mysql
Á¢¼Ó ÈÄ Æнº¿öµå º¯°æ Àӽà ºñ¹Ð¹øÈ£ ¿©ºÎ¿Í »ó°ü¾øÀÌ ¸ðµÎ Á¢¼Ó ÈÄ¿¡´Â Æнº¿öµå¸¦ º¯°æÇØ¾ß ÇÕ´Ï´Ù.
1 mysql> alter user ¡®root¡¯@¡¯localhost¡¯ identified by 'newpassword';
¼³Ä¡ °á°ú È®ÀÎ mysql status 1 2 3 4 $ /etc/init.d/mysqld status /etc/init.d/mysqld: line 46: /MySQL/mysql-5.7.21: Is a directory /etc/init.d/mysqld: line 47: /data: Is a directory SUCCESS! MySQL running (11642)
ÇÁ·Î¼¼½º È®ÀÎ 1 2 3 $ ps -ef | grep mysql root 11381 1 0 07:14 ? 00:00:00 /bin/sh /MySQL/mysql-5.7.21/bin/mysqld_safe --datadir=/data --pid-file=/data/ansible-node01.pid --user=root root 11642 11381 1 07:14 ? 00:00:11 /MySQL/mysql-5.7.21/bin/mysqld --basedir=/MySQL/mysql-5.7.21 --datadir=/data --plugin-dir=/MySQL/mysql-5.7.21/lib/plugin --user=root --log -error=ansible-node01.err --pid-file=/data/ansible-node01.pid --socket=/var/lib/mysql/mysql.sock --port=3306
¼¹ö Á¢¼Ó ÈÄ DB ¹× À¯Àú È®ÀÎ 1 2 3 4 5 6 7 8 9 10 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | sys | +--------------------+ 4 rows in set (0.01 sec)
1 2 3 4 5 6 7 8 9 10 mysql> select user from mysql.user; +---------------+ | user | +---------------+ | mysql | | mysql.session | | mysql.sys | | root | +---------------+ 4 rows in set (0.00 sec)
À̹ø Æ÷½ºÆÿ¡¼´Â ¹ÙÀ̳ʸ® ÆÄÀÏÀ» ÀÌ¿ëÇÑ 5.7 ¹öÀü ÀÌ»ó MySQL ¼³Ä¡ ¹æ¹ýÀ» »ìÆìºÃ½À´Ï´Ù.
Âü°í Related Posts