Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Mysql for linux mysql×Ô¶¯±¸·Ý½Å±¾

¿ÉÒÔ½«Õâ¸ö½Å±¾·Å½øcrontab£¬ËûµÄÅäÖÆÎļþÔÚ /etc/crontabÖÐÿÌìÁ賿ִÐÐÒ»´Î£¬×Ô¶¯±¸·Ý Õâ¸ö½Å±¾Ã¿Ìì×î¶àÖ»Ö´ÐÐÒ»´Î£¬¶øÇÒÖ»±£Áô×î½üÎåÌìµÄ±¸·ÝÔÚ·þÎñÆ÷ÉÏ¡£
#!/bin/bash
#This is a ShellScript For Auto DB Backup
#Powered by aspbiz
#2004-09
#Setting
#ÉèÖÃÊý¾Ý¿âÃû£¬Êý¾Ý¿âµÇ¼Ãû£¬ÃÜÂ룬±¸·Ý·¾¶£¬ÈÕ־·¾¶£¬Êý¾ÝÎļþλÖã¬
#ÒÔ¼°±¸·Ý·½Ê½
#ĬÈÏÇé¿öϱ¸·Ý·½Ê½ÊÇtar£¬»¹¿ÉÒÔÊÇmysqldump,mysqldotcopy
#ĬÈÏÇé¿öÏ£¬ÓÃroot(¿Õ)µÇ¼mysqlÊý¾Ý¿â£¬±¸·ÝÖÁ/root/namexxxxx.tgz
DBName=mysql
DBUser=root
DBPasswd=password
BackupPath=/root/
LogFile=/root/db.log
DBPath=/var/local/mysql5/var/
#BackupMethod=mysqldump
#BackupMethod=mysqlhotcopy
#BackupMethod=tar
#Setting End
NewFile="$BackupPath""$DBName"$(date +%y%m%d).tgz
DumpFile="$BackupPath""$DBName"$(date +%y%m%d)
OldFile="$BackupPath""$DBName"$(date +%y%m%d --date='5 days ago').tgz
echo "-------------------------------------------" >> $LogFile
echo $(date +"%y-%m-%d %H:%M:%S") >> $LogFile
echo "--------------------------" >> $LogFile
#Delete Old File
if [ -f $OldFile ]
then
   rm -f $OldFile >> $LogFile 2>&1
   echo "[$OldFile]Delete Old File Success!" >> $LogFile
else
   echo "[$OldFile]No Old Backup File!" >> $LogFile
fi
if [ -f $NewFile ]
then
   echo "[$NewFile]The Backup File is exists,Can't Backup!" >> $LogFile
else
   case $BackupMethod in
   mysqldump)
      if [ -z $DBPasswd ]
      then
         mysqldump -u $DBUser --opt $DBName > $DumpFile
      else
         mysqldump -u $DBUser -p$DBPasswd --opt $DBName > $DumpFile
      fi
      tar czvf $NewFile $DumpFile >> $LogFile 2>&1
      echo "[$NewFile]B


Ïà¹ØÎĵµ£º

MYSQL¹ØÓÚ×Ö·û±àÂë·½ÃæµÄ´æ´¢Ô­Àí

    * mysqlÊ×ÏȽ«Äõ½µÄÊý¾Ýת»»Îªcharacter_set_clientÖ¸¶¨µÄ±àÂë¸ñʽ£¬È»ºóת»»Îª character_set_connectionÖ¸¶¨µÄ¸ñʽ£¬×îºóÔÙ½«Êý¾Ý´æ´¢µ½Êý¾Ý¿â£¬´æ´¢¸ñʽΪcharacter_set_databaseËùÖ¸¶¨µÄ¸ñʽ£»
    * ´ÓÊý¾Ý¿â¶ÁÊý¾Ýʱ£¬½«Êý¾Ý¿â¸ñʽת»»Îªcharacter_set_resultsÖ¸¶¨µÄ¸ñʽ£¬ÔÙ·¢Ë ......

ÈçºÎÈÃmysqlÖ§³ÖÖÐÎÄgbk×Ö·û¼¯

ÔÚmysqlÊý¾Ý¿âÖУ¬Ê¹ÓõÄÊÇlatin×Ö·û¼¯£¬ËùÒÔÎÞ·¨Õý³£µÄÖ§³ÖÖÐÎÄ×Ö·û£¬ÖÐÎÄÔÚÊý¾Ý¿âÖÐÏÔʾΪÂÒÂë“£¿”ºÅ¡£ÎªÁËÈÃmysql¿ÉÒÔÕý³£Ê¹ÓÃÖÐÎÄ£¬ÓÈÆäÊǵ±Ê¹ÓÃjspÁ¬½ÓmysqlµÄʱºò£¬ÎÒÃÇÐèҪʹÓÃgbkµÄ×Ö·û¼¯£¬Òò´ËÎÒÃÇÒª¶Ômysql½øÐÐÒÔÏÂÉèÖã¬ÒÔ±ãÆäÓÐЧµÄÖ§³ÖÖÐÎÄ£º
IXDBA.NET¼¼ÊõÉçÇø
1.ÐÞ¸Ämy.cnfÎļþ
my.cnfÎļþÊÇ ......

linux mysql ¿ª·¢»·¾³

°²×°mysql
sudo apt-get install mysql-servel-5.0 mysql-client-5.0
ÏÂÔØ°²×°¹ý³ÌÖУ¬»áÌáʾÊäÈërootÃÜÂë
°²×°CÓïÑÔ±à³Ì½Ó¿Ú£º
 sudo apt-get install libmysqlclient15-dev
¸ü¶àapi ²é¿´£ºhttp://dev.mysql.com/doc/refman/5.0/en/c.html
Ïà¹ØmysqlÍ·ÎļþºÍ¿âÎļþ°²×°ÔÚ/usr/include/mysql/ºÍ/usr/lib/mysqlÄ¿ ......

´´½¨mysqlʵÀý

1. ÔÚ/etc/my.cnfÖмÓÈëÒ»ÏÂÄÚÈÝ [mysqld_dev]
socket=/tmp/mysql.sock
port=3307
pid-file=/var/run/mysqld/mysqld_dev.pid
datadir=/var/lib/mysql_dev
log=/var/log/mysqld_dev.log
log-error=/var/log/mysqld_dev.err.log
user=mysql 2. ¸ù¾ÝÒÔÉÏÄÚÈÝ´´½¨Ä¿Â¼ºÍÎļþ mkdir /var/lib/mysqld_dev chown mys ......

MySQLÖеÄÒ»¸öÄÑÌâ

×òÌ죬ÎÒͻȻÏë°ÑÒ»¸öÊý¾Ý¿âÀïµÄÿ¸ö±í£¬ÒÔ¼°Ã¿¸ö±íµÄ·Ç¿Õ×ܼͼÊý´æÔÚÁíÒ»¸ö±íÀïÃæ¡£
Ê×ÏÈ£¬´´½¨ÁËÒ»¸ö´æ·ÅÊý¾ÝµÄ±í£º
create table tables
(
name varchar(50),
number int
);
insert into tables select table_name from information_schema.tables where table_shema = 'test';
µ«ÊDz»ÖªµÀÓÐûÓз½·¨£¬½«·Ç¿ÕµÄ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ