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;
}
?>
Ïà¹ØÎĵµ£º
If you set it in the cnf(it may be my.ini file) you will likely need to restart the server. Optionally, that is a dynamic variable and can be SET GLOBAL or SET SESSION from the command line as well.So just do as follows.
mysql>show variables like’max_allowed_packet’;
......
1,ÔÚwindow×Ô´øµÄ·À»ðǽÀïµÄÀýÍâÌí¼Ó3306¶Ë¿Ú£¬ÎªTCP
2£¬½ñÌìÔÚÓÃÔ¶³ÌÁ¬½ÓMysql·þÎñÆ÷µÄÊý¾Ý¿â£¬²»¹ÜÔõôŪ¶¼ÊÇÁ¬½Ó²»µ½£¬´íÎó´úÂëÊÇ1130£¬ERROR 1130: Host 192.168.2.159 is not allowed to connect to this MySQL server
²ÂÏëÊÇÎÞ·¨¸øÔ¶³ÌÁ¬½ÓµÄÓû§È¨ÏÞÎÊÌâ¡£½á¹ûÕâÑù×Ó²Ù×÷mysql¿â£¬¼´¿É½â¾ö¡£ÔÚ±¾»úµÇÈëmysqlºó£¬¸ ......
ÏÖÔÚа汾µÄmysql¼¯ÈºÒÑ´ÓÆÕͨµÄmysql°æ±¾ÖÐÌáÈ¡³öÀ´ÁË£¬Ò²¾ÍÊÇÒª×ömysqlµÄ¼¯ÈºÐèҪѡÔñmysql¼¯Èº¶ÔÓ¦µÄÈí¼þ°ü¡£¶øÇÒmysqlרÃÅÌṩÁËÕë¶Ôredhat ²Ù×÷ϵͳµÄrpmÈí¼þ°ü¡£¿ÉÒÔ´Óhttp://dev.mysql.com/downloads/»ñµÃ¶ÔÓ¦µÄ²Ù×÷ϵͳµÄrpmÈí¼þ°ü¡£ÔÚÕâÀïÖ÷ ......
http://www.cnblogs.com/neonlight/archive/2008/08/25/1276178.html
½üÒ»¶Îʱ¼ä£¬ºÜ¶à²¿ÃÅͬÊ·´Ó³ÔÚʹÓÃmysqlµÄ¹ý³Ì³öÏÖÊý¾Ý¿âÁ¬½Ó×Ô¶¯¶Ï¿ªµÄÎÊÌ⣬ÎÒ¶Ô¸ÃÎÊÌâ×öÁËһЩʵÑé¡£
¹ØÓÚmysql×Ô¶¯¶Ï¿ªµÄÎÊÌâÑо¿½á¹ûÈçÏ£¬ÔÚmysqlÖÐÓÐÏà¹Ø²ÎÊýÉ趨£¬µ±Êý¾Ý¿âÁ¬½Ó¿ÕÏÐÒ»¶¨Ê±¼äºó£¬·þÎñÆ÷¾Í
»á¶Ï¿ªµÈ´ý³¬Ê±µÄÁ¬½Ó£º
1¡¢Ïà¹Ø²Î ......
sudo apt-get install mysql-server mysql-client
sudo apt-get install sun-java6-jdk(°²×°³öÒâÍ⣬sudo dpkg -P sun-java6-bin£¬È»ºóÖØÐ°²×°)
sudo vi /etc/network/interfaces ÅäÖÃÍøÂç
auto eth0
iface eth0 inet dhcp(static)
address 192.168.8.108
netmask 255.255.255.0
gateway 192.168.8.1
£ºx±£´æ
sud ......