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

ͨÓõÄmysql dump³ÌÐò

¿ÉÒÔÊÊÓÃÈκÎsql , ×Ô¶¯Ê¶±ð×Ö¶ÎÃû£¬ gzipѹËõ , ´øÊä³öbuffer , Ö§³Ö·Ö¿â·Ö±í
ÐèÒª¸¨Öú´úÂëºÍMakefie , ÏÂÃæÊÇÖ÷³ÌÐò´úÂ룬 
/**
* mysqlÊý¾Ý±ídump³ÌÐò
* @author : cheng limin
* @date : 2010-1-18
*
* ʹÓÃÑùÀý:
*./dump_mysql -c ../conf/dump.conf
* -t xml
* -s "select * from * where punish_type != 0"
* -f ctu.txt
*/
#include <iostream>
#include <string>
#include <errno.h>
#include <time.h>
#include <sys/time.h>
#include "mysql.h"
#include "INIParser.h"
#include "tbZip.h"
using namespace __gnu_cxx;
using namespace std;
#define OUT_FORMAT_TXT 0 /* Êä³öÎļþ¸ñʽ ÐÐÁиñʽ */
#define OUT_FORMAT_XML 1 /* Êä³öÎļþ¸ñʽ xml¸ñʽ */
/* ´ÓÃüÁîÐлñµÃµÄ²ÎÊý */
string g_confFile = ""; /* ÅäÖÃÎļþ */
string g_sectionName = ""; /* ÅäÖÃÎļþsection½ÚÃû³Æ */
string g_sql = ""; /* ÐèÒªÖ´ÐеÄsql */
string g_fileName = ""; /* Êä³öÎļþÃû */
/* ´ÓÅäÖÃÎļþ»ñµÃµÄ²ÎÊý */
string g_fieldSep = ""; /* ×ֶνáÊø */
string g_lineSep = ""; /* Ðнáβ */
string g_host = ""; /* Ö÷»úÃû */
int g_port = 3306; /* ¶Ë¿ÚºÅ ĬÈÏ3306 */
string g_user = ""; /* Óû§Ãû */
string g_passwd = ""; /* ÃÜÂë */
string g_db = ""; /* ¿âÃû */
string g_charset = ""; /* Êý¾Ý¿â×Ö·û¼¯ */
int g_compType = 0; /* Êä³öÎļþѹËõ·½Ê½ ĬÈÏ0 0=²»Ñ¹Ëõ 1=gzip */
int g_outFormat = OUT_FORMAT_TXT; /* Êä³öÎļþ¸ñʽ , ĬÈÏΪÎı¾*/
FILE *g_fp; /* Êä³öÎļþ¾ä±ú */
tbZip *g_tz; /* ѹËõÎļþ¹¤¾ßÀà */
/**
* ʹÓðïÖú
*
* @param progName ³ÌÐòÃû
*/
void usage(const char *progName)
{
fprintf(stderr, "************************************************* \n");
fprintf(stderr, "Usage: %s \n", progName);
fprintf(stderr, " -c configeFile ³ÌÐòµÄÅäÖÃÎļþ \n");
fprintf(stderr,


Ïà¹ØÎĵµ£º

MYsql ÒìµØ±¸·Ý½Å±¾

ÔÚÒìµØµÄ·þÎñÆ÷±¸·ÝMysqlʱ£¬ÒìµØµÄ·þÎñÆ÷ûÓа²×°MysqlÊý¾Ý¿â£¬±¸·ÝµÄmysqldumpÃüÁîÊDz»ÄÜÉúЧµÄ¡£ËùÒÔ¿ÉÒ԰Ѱ²×°mysqlÊý¾Ý¿âËùÔÚ·þÎñÆ÷ÖеÄmysqldump.exe£¨È磺C:\Program Files\MySQL\MySQL Server 5.0\binĿ¼ÖеÄmysqldump.exe£©¿½±´µ½ÒìµØ·þÎñÆ÷ÖеÄÒ»¸öĿ¼ÖУ¨È磺F:\MySQLBackup£©¡£
 
±ÈÈçÎļþà ......

¹ØÓÚMySQLµÄÓû§²Ù×÷

Ò»¡¢²é¿´Óû§
1¡¢ÏÔʾµ±Ç°Ê¹ÓõÄuser¼°host£º
mysql>select USER();
2¡¢ÏÔʾ¸ÃÊý¾Ý¿âÊÚȨµÇ½µÄÓû§Ãû(²»ÏÔÊ¾ÖØ¸´Óû§Ãû)£º
mysql>use mysql;
mysql>select distinct(User) from user;
3¡¢ÏÔʾ¸ÃÊý¾Ý¿âÊÚȨµÇ½µÄÓû§Ãû¼°hostÏÞÖÆ£º
£¨1£©·½·¨Ò»£º
mysql>use mysql;
mysql>select User,host from u ......

MySQLÊý¾Ý¿âÎļþ½éÉÜ

mysqlµÄÊý¾Ý´¢´æÄ¿Â¼ÔÚmysqlµÄÅäÖÃÎļþmy.iniÎļþÉèÖ㬸ñʽÈçÏ£º
# Uncomment the following rows if you move the MySQL distribution to another
# location
basedir = d:/cyoa/mysql_cy/
datadir = d:/cyoa/mysql_cy/data/
      ÆäÖÐdatadirĿ¼¶¨ÒåÁËmysqlµÄÊý¾Ý´æ´¢Î»Öã¬MySQLµÄÿ¸ ......

mysql Ö´ÐжàÌõÓï¾ä

ÔÚ¿´ÏîÄ¿µÄÊÇ¿´µ½mysql°æ±¾µÄÏîÄ¿£¬·¢ÏÖÖ´ÐжàÌõsqlÓï¾äÊǶ¼ÊÇÏÈ·ÖÀëÒ»ÌõÌõµÄÊý¾Ý¿âÔÙÒ»ÌõÌõÖ´ÐУ¬ÎÒÏëÓ¦¸ÃÓа취һÌõÌõÖ´ÐеİÉ
ËùÒÔ½ñÌìÌØÒâµÄ²éÕÒÁËÒ»ÏÂ
ÔÚjdbcÏÂ˵¿ÉÒÔÉèÖÃÁ¬½Ó×Ö·û´®µÄʱºòÉèÖÃÒ»ÏÂ
ÉèÖóÉÈçÏ嵀 jdbc:mysql://192.168.3.180/sample?user=root&password=&allowMultiQueries=true
¾Í¿ÉÒÔÖ´Ð ......

MySQLÐÔÄÜÓÅ»¯


MySQLÐÔÄÜÓÅ»¯µÄ×î¼Ñ20+Ìõ¾­Ñé
½ñÌ죬Êý¾Ý¿âµÄ²Ù×÷Ô½À´Ô½³ÉΪÕû¸öÓ¦ÓõÄÐÔÄÜÆ¿¾±ÁË£¬Õâµã¶ÔÓÚWebÓ¦ÓÃÓÈÆäÃ÷ÏÔ¡£¹ØÓÚÊý¾Ý¿âµÄÐÔÄÜ£¬Õâ²¢²»Ö»ÊÇDBA²ÅÐèÒªµ£ÐĵÄÊ£¬¶øÕâ¸üÊÇÎÒÃdzÌÐòÔ±ÐèҪȥ¹Ø×¢µÄÊÂÇé¡£µ±ÎÒÃÇÈ¥Éè¼ÆÊý¾Ý¿â±í½á¹¹£¬¶Ô²Ù×÷Êý¾Ý¿âʱ£¨ÓÈÆäÊDzé±íʱµÄSQLÓï¾ä£©£¬ÎÒÃǶ¼ÐèҪעÒâÊý¾Ý²Ù×÷µÄÐÔÄÜ¡£ÕâÀÎÒÃDz»» ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ