::: Zany's Homepage ::: Zany Wiki | »çÀÌÆ® ÅëÇÕ °Ë»ö
 
 
 

[CentOS] (SELinux ȯ°æ) mysql µ¥ÀÌÅÍ °æ·Î ¹Ù²Ù±â.

°Ô½ÃÆÇ
Unix/Linux
ÀÛ¼ºÀÚ
helix
ÀÛ¼ºÀÏ
2013-03-19 15:00:34
ÀÐÀº¼ö
8148
ÆòÁ¡
   
Ç¥½Ã¿É¼Ç
HTML»ç¿ë | ÀÚµ¿BRűנ| °ø¹é¹®ÀÚÇã¿ë | °¡¿îµ¥Á¤·Ä | °íÁ¤Æø±Û²Ã | ÀÚµ¿URL¸µÅ© | ¸¶¿ì½º¼±ÅÃ
°ü·Ã¸µÅ©01
http://crashmag.net/change-the-default-mysql-data-directory-with-selinux-enabled 
ÀÌ ±ÛÀº mysql ¼³Á¤°ú °ü·ÃµÈ ³»¿ëÀº ÀüÇô ¾ø´Ù.

mysql µ¥ÀÌÅÍ °æ·Î¸¦ ¹Ù²Ù¾úÀ» ¶§,
SELinux °ü·ÃÇÏ¿© º¸¾È ÄÁÅؽºÆ® ¼³Á¤°ú °ü·ÃµÈ ³»¿ë¸¸ ´Ù·é´Ù.

ÀÌ ±Û ¿Ü¿¡ my.cnf º¯°æ°ú µ¥ÀÌÅÍ µð·ºÅ丮ÀÇ owner ¹× ±ÇÇÑ ¼³Á¤°ú °ü·Ã µÈ »çÇ×Àº ´Ù¸¥ ±ÛÀ» Âü°í
http://crashmag.net/change-the-default-mysql-data-directory-with-selinux-enabled
¿©±â¿¡ Àß Á¤¸®µÇ¾î ÀÖ´Ù.

======================================================

SELinux ȯ°æÀ̶ó¸é,
mysql data file À» ´Ù¸¥ µð·ºÅ丮¿¡ ¿Å±â°í,
mysql µ¥¸óÀ» ³»·È´Ù ¿Ã·ÁÁֱ⸸ Çϸé Æ۹̼ÇÀ̳ª º¸¾È °ü·ÃµÈ ¿¡·¯·Î ÀÎÇØ Àç±âµ¿ÀÌ µÇÁö ¾ÊÀ» °ÍÀÌ´Ù.

¿øÇÏ´Â À§Ä¡·Î mysql data file À» ¿Å±â°í ³­ ÈÄ,
SELinux º¸¾È ¼³Á¤À» ¾Æ·¡¿Í °°Àº ¸í·ÉÀ» ÅëÇؼ­ ¼öÁ¤ÇØÁÖ¾î¾ß ÇÑ´Ù.

»õ·Î ¿Å±ä µð·ºÅ丮°¡ /mnt/ssd1/mysql ÀÎ °æ¿ì...

[1] shell> getenforce
[2] shell> semanage fcontext -a -t mysqld_db_t "/mnt/ssd1/mysql(/.*)?"
[3] shell> restorecon -Rv /mnt/ssd1/mysql
[4] shell> chcon -R -u system_u -r object_r -t mysqld_db_t /mnt/ssd1/mysql
[5] shell> ls -lh -Zd /mnt/ssd1/mysql


[1] SELinux ÀÇ ÇöÀç »óÅÂ(¸ðµå)¸¦ °¡Á®¿Â´Ù.
[2] semanage ¸í·ÉÀ» ÅëÇØ ¿Å±ä µð·ºÅ丮 ¹× ÇÏÀ§ µð·ºÅ丮¿¡ º¸¾È ÄÁÅؽºÆ® °´Ã¼¸¦ Ãß°¡ÇØÁØ´Ù.
[3] º¸¾È ÄÁÅؽºÆ®¸¦ Àç¼³Á¤ ÇÑ´Ù.
[4] ÀÌ °úÁ¤Àº [2] ¸¦ ÇßÀ¸¸é ÇÊ¿ä ¾ø´Ù.
[5] º¸¾È ÄÁÅؽºÆ®°¡ Á¦´ë·Î ¹Ý¿µµÇ¾ú´ÂÁö ls ¸í·É¿¡ Z ¿É¼ÇÀ» ÁÖ¾î È®ÀÎÇÑ´Ù.


ÁÖ1) semanage - SELinux Á¤Ã¥ °ü¸® ¸í·É¾î


¹¹ ÀÌÁ¤µµ Çϸé Á¤»ó ±âµ¿ÀÌ µÇ¾î¾ß ¸Â´Âµ¥,
service mysqld start ¶Ç´Â /etc/init.d/mysqld start Çϸé,
/var/log/mysqld.log ÆÄÀÏ¿¡ ¾Æ·¡¿Í °°Àº ±ÇÇÑ ¿À·ù¸¦ »ÕÀ¸¸é¼­ ½ÃÀÛµÇÁö ¾Ê´Â °æ¿ì°¡ ¹ß»ýÇÏ¿´´Ù.
(CentOS 6.3 - Kernel version 2.6.32-358.2.1.el6.x86_64)

130319 15:30:18 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
130319 15:33:21 mysqld_safe Starting mysqld daemon with databases from /mnt/ssd1/mysql
130319 15:33:22 [Warning] Can't create test file /mnt/ssd1/mysql/testserver.lower-test
130319 15:33:22 [Warning] Can't create test file /mnt/ssd1/mysql/testserver.lower-test
/usr/libexec/mysqld: Can't change dir to '/mnt/ssd1/mysql/' (Errcode: 13)
130319 15:33:22 [ERROR] Aborting

130319 15:33:22 [Note] /usr/libexec/mysqld: Shutdown complete

/usr/libexec/mysqld °¡ »õ·Î ¹Ù²ï µ¥ÀÌÅÍ °æ·Î·Î change dir ÇÒ ¼ö ¾ø´Ù´Â ¿¡·¯¸Þ½ÃÁö Àε¥,
¾Æ·¡¿Í °°Àº ¸í·ÉÀ¸·Î ½ÇÇàÇϸé Á¤»óÀûÀ¸·Î ±âµ¿ÀÌ µÈ´Ù.

shell> mysqld_safe --datadir=/mnt/ssd1/mysql --user=mysql &

ÀÌ·¸°Ô ±âµ¿ÇÏ¿©µµ mysql Àº Á¤»ó µ¿ÀÛÇÏ¿´À¸¸ç
service mysqld stop ¸í·ÉÀ¸·Îµµ Á¤»ó Á¾·áµÇ¾ú´Ù.


Âü°í URL) [¿µ¹®]
http://crashmag.net/change-the-default-mysql-data-directory-with-selinux-enabled
http://phe1129.wordpress.com/2012/04/02/change-mysql-data-folder-on-selinux
http://shriikant.blogspot.kr/2010/06/usrlibexecmysqld-cant-change-dir-to.html

 °Ô½ÃÆÇ ±Û ¸ñ·Ï
No Subject Poster Hits Posted
7811 helix 2571 2014-03-14 15:39:00
7641 helix 2688 2014-02-24 18:14:38
7576 helix 2371 2014-02-17 15:06:13
7423 helix 2530 2014-02-03 10:34:05
4155 helix 3297 2013-03-23 18:51:07
helix 8148 2013-03-19 15:00:34
4102 helix 5525 2013-02-04 23:29:16
4071 helix 3593 2013-01-15 15:21:37
4065 helix 2670 2013-01-05 22:37:11
4059 helix 2517 2012-12-24 15:38:00
4022 helix 6151 2012-12-11 00:41:25
ÄÚ¸àÆ®
ÀÛ¼ºÀÚ
                       
 
zany.kr
  Copyright ¨Ï 2002-2010 Zany's Programming Lab. All Rights Not Reserved.
temporary This Page loads on 0.000 Secs