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

mysql ±¸·ÝÁ·Ï°

<?php
$db_name="new";
mysql_connect("localhost","root","123456");
mysql_select_db($db_name);
$tb=mysql_list_tables($db_name);
$sql="";
while($query=mysql_fetch_row($tb)){
 $sql="";$table_sql="";
    $sql.= get_table_fn($query[0]);
    get_table_row($query[0]);
   // echo $table_sql."\n";
}
$f=fopen($db_name.".sql","w+");
fwrite($f,$sql);
fclose($f);
//±¸·ÝËùÓбíSQLÓïÃû
function get_table_fn($db_name){
 $field="CREATE TABLE `$db_name`( \n";
  $query=mysql_query("select * from $db_name");
 while($row=mysql_fetch_field($query)){
   if($row->not_null===1){$null="DEFAULE NULL";}else{$null="NOT NULL";}
   if($row->primary_key===1){$key="primary key";}else{$key="";}
   if($row->unsigned===1){$unsig="unsigned";}else{$unsig="";}
   $field.="`$row->name` $row->type($row->max_length) $null $key $unsig ,\n";
 }
 $field.=")\n";
 return $field;
}
//±¸·ÝËùÓбíµÄÊý¾ç
function get_table_row($db_name){
     $query=mysql_query("select * from $db_name");
     $field="";
     $num_rows= mysql_num_rows($query);
     $num_field=mysql_num_fields($query);
        $table_sqls="";
  while($row=mysql_fetch_row($query)){
     $r= get_table_fd($num_field,$row);
     $table_sqls.="insert into `$db_name` values($r)\n";
   }
  $f=fopen($db_name.".sql","w+");
  fwrite($f,$table_sqls);
  fclose($f);
}
//»ñȡÿÕűíµÄ×Ö¶ÎÖµ
function get_table_fd($num_field,$row){
 $r="";
 for($i=0;$i<$num_field;$i++){
  $r.= "'$row[$i]',";
 }
    $r=substr($r, 0, strlen($r)-1);
    return  $r;
}
?>


Ïà¹ØÎĵµ£º

Initial Startup of MySQL Cluster


Starting the cluster is not very difficult after it has been configured. Each cluster node process must be started separately, and on the host where it resides. The management node should be started first, followed by the data nodes, and then finally by any SQL nodes:
On the management host, issu ......

MysqlµÄGROUP_CONCAT()º¯ÊýʹÓ÷½·¨ ¶àÐкϲ¢º¯Êý

GROUP_CONCAT ÊÇÒ»¸öºÏ²¢¶àÐеĺ¯Êý£¬Ò»°ãÓõÄÉÙ£¬ËùÒԺܶàÈ˶¼²»ÖªµÀ£¬ÎÒÒ²ÊÇÒ»¸ö£¬½ñÌìżȻ¿´µ½£¬¹Ê¼ÇÏ·½·¨£»
GROUP_CONCATµÄÓï·¨ÈçÏ£º
GROUP_CONCAT([DISTINCT] expr [,expr ...][ORDER BY {unsigned_integer | col_name | expr}[ASC | DESC] [,col_name ...]][SEPARATOR str_val])
ÏÂÃæÑÝʾһÏÂÕâ¸öº¯Êý£¬ÏȽ¨Á¢Ò ......

linuxϵ¼Èë¡¢µ¼³ömysqlÊý¾Ý¿âÃüÁî

Ò»¡¢µ¼³öÊý¾Ý¿âÓÃmysqldumpÃüÁעÒâmysqlµÄ°²×°Â·¾¶£¬¼´´ËÃüÁîµÄ·¾¶£©£º
1¡¢µ¼³öÊý¾ÝºÍ±í½á¹¹£º
mysqldump -uÓû§Ãû -p Êý¾Ý¿âÃû > Êý¾Ý¿âÃû.sql
#/usr/local/mysql/bin/mysqldump -uroot -p abc > abc.sql
Çûسµºó»áÌáʾÊäÈëÃÜÂë
2¡¢Ö»µ¼³ö±í½á¹¹
mysqldump -uÓû§Ãû -p -d Êý¾Ý¿âÃû > Êý¾Ý¿âÃû.sql
# ......

MySQL²éѯÓÅ»¯ Ë÷Òý

MySQLË÷Òý
    MySQL²éѯÓÅ»¯×îÖØÒªµÄµ±Êô½¨Á¢ÕýÈ·µÄË÷Òý£¬Ã»ÓÐË÷Òý£¬Ãæ¶Ôº£Á¿Êý¾Ý£¬Ò»ÇеÄÓÅ»¯´¿Êô¿Õ»°¡£Ê²Ã´ÊÇË÷Òý£¿Ë÷ÒýΪʲôÄÇÃ´ÖØÒªÄØ£¿ÕâЩÎÊÌâÕâÀï¾Í²»Ì¸ÁË£¬»¹ÊÇÏÈдÏÂÎÒÊ×´ÎÓÅ»¯MySQL²éѯº£Á¿Êý¾ÝµÄÐĵðɣ¬Êý¾Ý¿â±íÀàÐÍÊÇMyISAM¡£
    Èç¹û¼òµ¥µÄÒ»¸ö²éѯÓï¾ä£¬MySQL²éѯËÙ¶È»¹ ......

MySQL Cluster Overview


MySQL Cluster
is a technology that enables
clustering of in-memory databases in a shared-nothing system. The
shared-nothing architecture allows the system to work with very
inexpensive hardware, and with a minimum of specific requirements
for hardware or software.

......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ