MySQL rpm°²×°ºóµÄ¼¸¸öĿ¼¡£
1¡¢Êý¾Ý¿âĿ¼
/var/lib/mysql/
2¡¢ÅäÖÃÎļþ
/usr/share/mysql£¨mysql.serverÃüÁî¼°ÅäÖÃÎļþ£©
3¡¢Ïà¹ØÃüÁî
/usr/bin(mysqladmin mysqldumpµÈÃüÁî)
4¡¢Æô¶¯½Å±¾
/etc/rc.d/init.d/£¨Æô¶¯½Å±¾ÎļþmysqlµÄĿ¼£©
ÆäÖÐĬÈϵÄÊý¾ÝÎļþ´æ´¢Ä¿Â¼Îª/var/lib/mysql¡£¼ÙÈçÒª°ÑĿ¼ÒƵ½/home/dataÏÂÐèÒª½øÐÐÏÂÃ漸²½£º
1¡¢homeĿ¼Ï½¨Á¢dataĿ¼
cd /home
mkdir data
2¡¢°ÑMySQL·þÎñ½ø³ÌÍ£µô£º
mysqladmin -u root -p shutdown
3¡¢°Ñ/var/lib/mysqlÕû¸öĿ¼ÒƵ½/home/data
mv /var/lib/mysql¡¡/home/data/
ÕâÑù¾Í°ÑMySQLµÄÊý¾ÝÎļþÒƶ¯µ½ÁË/home/data/mysqlÏÂ
4¡¢ÕÒµ½my.cnfÅäÖÃÎļþ
Èç¹û/etc/Ŀ¼ÏÂûÓÐmy.cnfÅäÖÃÎļþ£¬Çëµ½/usr/share/mysql/ÏÂÕÒµ½*.cnfÎļþ£¬¿½±´ÆäÖÐÒ»¸öµ½/etc/²¢¸ÄÃûΪmy.cnf)ÖС£ÃüÁîÈçÏ£º
[root@test1 mysql]# cp /usr/share/mysql/my-medium.cnf¡¡/etc/my.cnf
5¡¢±à¼MySQLµÄÅäÖÃÎļþ/etc/my.cnf
Ϊ±£Ö¤MySQLÄܹ»Õý³£¹¤×÷£¬ÐèÒªÖ¸Ã÷mysql.sockÎļþµÄ²úÉúλÖá£ÐÞ¸Äsocket=/var/lib/mysql/mysql.sockÒ»ÐÐÖеÈ
ºÅÓұߵÄֵΪ£º/home/mysql/mysql.sock ¡£²Ù×÷ÈçÏ£º
vi¡¡ my.cnf¡¡¡¡¡¡ (ÓÃvi¹¤¾ß±à¼my.cnfÎļþ£¬ÕÒµ½ÏÂÁÐÊý¾ÝÐÞ¸ÄÖ®)
# The MySQL server
[mysqld]
port¡¡¡¡¡¡= 3306
#socket¡¡ = /var/lib/mysql/mysql.sock£¨ÔÄÚÈÝ£¬ÎªÁ˸üÎÈÍ×Óá°#¡±×¢ÊÍ´ËÐУ©
socket¡¡ = /home/data/mysql/mysql.sock¡¡¡¡¡¡£¨¼ÓÉÏ´ËÐУ©
6¡¢ÐÞ¸ÄMySQLÆô¶¯½Å±¾/etc/rc.d/init.d/mysql
×îºó£¬ÐèÒªÐÞ¸ÄMySQLÆô¶¯½Å±¾/etc/rc.d/init.d/mysql£¬°ÑÆäÖÐdatadir=/var/lib/mysqlÒ»ÐÐÖУ¬µÈºÅÓұߵÄ·¾¶¸Ä³ÉÄãÏÖÔÚµÄʵ¼Ê´æ·Å·¾¶£ºhome/data/mysql¡£
[root@test1 etc]# vi¡¡/etc/rc.d/init.d/mysql
#datadir=/var/lib/mysql¡¡¡¡¡¡¡¡£¨×¢ÊÍ´ËÐУ©
datadir=/home/data/mysql¡¡¡¡ £¨¼ÓÉÏ´ËÐУ©
7¡¢ÖØÐÂÆô¶¯MySQL·þÎñ
/etc/rc.d/init.d/mysql¡¡start
»òÓÃrebootÃüÁîÖØÆôLinux
Èç¹û¹¤×÷Õý³£Òƶ¯¾Í³É¹¦ÁË£¬·ñÔò¶ÔÕÕÇ°ÃæµÄ7²½ÔÙ¼ì²éһϡ£