ºìÁªLinuxÃÅ»§
Linux°ïÖú

UbuntuϵÄÃâ°²×°MySQL

·¢²¼Ê±¼ä:2008-08-14 00:04:03À´Ô´:ºìÁª×÷Õß:Stealth
È«Ãæתµ½LinuxϹ¤×÷ÁË£¬ÒÔÇ°windowsϵÄһЩ·þÎñ£¬Êý¾Ý¿â¶¼ÒªÒ»²½²½×ª¹ýÀ´ÁË¡£apache£¬tomcat£¬jbossµÈÇáËɸ㶨£¬¾ÍÊÇÕâ¸ömysql¾¹È»ÕÛÌÚÁË2£¬3Ìì¡£Ö÷ÒªÊÇΪÁ˱£Ö¤copy¹ýÀ´¼òµ¥ÅäÖþͿÉÒÔʹÓã¬ËùÒÔûÓÐʹÓÃÆäĬÈÏ°²×°Â·¾¶£¨±£³ÖwindowsϵÄÏ°¹ß£¬Server ͳһ·ÅÔÚ myServeresĿ¼Ï£©¡£½á¹ûÅäÖÃÎļþ£¬È¨ÏÞµÈÕÛÌÚÁË°ëÌì¡£

ºÃÁË£¬ÑÔ¹éÕý´«¡£Ê×ÏÈÃèÊöÏÂÎÒµÄϵͳ»·¾³£ºUbuntu8.04.1, °²×°ÁËbuild-essential 11.3 ,g++ 4.2.3

ÏÂÔØmysql

ÍøÖ·: http://dev.mysql.com/downloads/mysql/5.1.html
ÎÒÏÂÔصÄÊÇ5.1°æµÄ Linux (non RPM packages) °ü, windows Without installer (unzip in C:\) °ü(Õâ¸ö°üµÄÓô¦ÏÂÃæ˵Ã÷).
2. ½âѹmysqlµ½¡«/myServeres/ ÏÂ, ¸ÄĿ¼ÃûΪ mysql51 (ÆäʵÄã·ÅÔÚÄÄÀﶼÐÐ,Ö»ÒªÄãÓÐȨÏÞ)
½âѹ Windows Without installer (unzip in C:\) °ü,½«ÀïÃæµÄdataĿ¼ ¸´ÖƵ½ mysql51Ŀ¼ÏÂ. (Õâµã·Ç³£ÖØҪѽ
3. ÉèÖÃmysql51 ¼°Æä×ÓĿ¼,ÎļþµÄ ȨÏÞ,±£Ö¤ÄãµÄÆô¶¯mysqlµÄÓû§ÓµÓжÁдȨÏÞ.
4. ±àдÆô¶¯½Å±¾ mysql.sh, ×¢ÒâÒÀ¾ÝÇé¿öÐÞ¸ÄMYSQL_HOME µÄ·¾¶Ñ½

ÒýÓÃ:
#!/bin/bash
# Path to mySQL
MYSQL_HOME="/home/james/myServeres/mysql51"

# Check for required environment variables.
if [ -z "$MYSQL_HOME" ];
then
echo Error: MYSQL_HOME environment variable is not set.
exit 2
fi
# paser command params
case "$1" in
start)
#/var/run/mysqld/mysqld.sock
if test -e $MYSQL_HOME/mysqld.sock
#$MYSQL_HOME/bin/mysqladmin ping --socket=$MYSQL_HOME/mysqld.sock >nul 2>&1
then
echo MySQL already Start!
else
exec $MYSQL_HOME/bin/mysqld --no-defaults --user=james --basedir=$MYSQL_HOME --character-sets-dir=$MYSQL_HOME/share/charsets --language=$MYSQL_HOME/share/english --character-set-server=gb2312 --socket=$MYSQL_HOME/mysqld.sock
fi
;;
stop)
if test -e $MYSQL_HOME/mysqld.sock
#$MYSQL_HOME/bin/mysqladmin ping --socket=$MYSQL_HOME/mysqld.sock >nul 2>&1
then
echo please input mysql user name:
read name
echo please input mysql password:
read password
exec $MYSQL_HOME/bin/mysqladmin shutdown --user=$name --password=$password --socket=$MYSQL_HOME/mysqld.sock
fi
;;
*)
echo "Usage: mysql.sh {start|stop}"
;;
esac
exit 0


5. ±£´æmysql.shµ½ mysql51Ŀ¼²¢ ¸³ÓèÖ´ÐÐȨÏÞ.
6. mysql51Ŀ¼ÏÂ: ./mysql.sh start
7. OK, ÏíÊÜÄãµÄÃâ°²×° mysql Êý¾Ý¿â°É¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ