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

ÅúÁ¿Ìø¹ýmysql slave´íÎóС½Å±¾

[perl] ÅúÁ¿Ìø¹ýmysql slave´íÎóС½Å±¾
2009Äê02ÔÂ20ÈÕ 16:24
·¢ÏÖmysql slave·þÎñÆ÷¾­³£ÒòΪһЩÌØÊâ×Ö·û»òÕß·ûºÅ²úÉúµÄ¸üÐÂÓï¾ä±¨´í£¬Õû¸öͬ²½Ò²»áÒò´Ë¶ø¿¨ÔÚÄÇ£¬×î³õµÄ°ì·¨Ö»ÊÇÊÖ¶¯È¥³ö´íµÄ»úÆ÷£¬Ö´ÐÐÏÂÃæÈýÌõsqlÓï¾ä£¬Ìø¹ý´íÎó¼´¿É¡£
slave stop;
set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
slave start;
һ̨slave»úÆ÷ÓÃÕâÑù·½·¨»¹ÐУ¬¶ą̀¾ÍÂé·³ÁË£¬¾Í˳ÊÖдÁ˸ö¼òµ¥µÄperl½Å±¾£¬·½±ãͳһÌø¹ý´íÎ󣬴úÂëÈçÏ£º
#!/usr/bin/env perl
use strict;
use warnings;
my @hosts = qw/
192.168.1.123:root:tt1234
192.168.1.124:root:tt1234
/;
foreach (@hosts) {
    my ($ip, $usr, $pass) = split ':';
    print "// ----- $ip\n";
    slaveskip($ip, $usr, $pass);
    print "\n";
}
# mysql slave skip
sub slaveskip {
    my ($ip, $usr, $pass) = @_;
    my $info = `mysql -u$usr -p$pass -h$ip -e 'show slave status\\G;'`;
    # Slave_SQL_Running is No
    if (($info =~ /Slave_IO_Running: Yes/) && ($info =~ /Slave_SQL_Running: No/)) {
        my $errno = $1 if $info =~ /Last_Errno: (\d*)/;
        my $error = $1 if $info =~ /Last_Error: (.*)/;
        if ($errno > 0 && length($error) > 0) {
            print "slave error**\n";
            print "errno : $errno\nerror : $error\n";
            system("mysql -u$usr -p$pass -h$ip -e 'slave stop;'");
            system("mysql -u$usr -p$pass -h$ip -e 'set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;'");
            system("mysql -u$usr -p$pass -h$ip -e 'slave start;'");
        }
    } else {
&n


Ïà¹ØÎĵµ£º

Mysql³£ÓÃÃüÁîÐдóÈ«

µÚÒ»ÕС¢mysql·þÎñµÄÆô¶¯ºÍÍ£Ö¹
net stop mysql
net start mysql
µÚ¶þÕС¢µÇ½mysql
Óï·¨ÈçÏ£º mysql -uÓû§Ãû -pÓû§ÃÜÂë
¼üÈëÃüÁîmysql -uroot -p£¬ »Ø³µºóÌáʾÄãÊäÈëÃÜÂ룬ÊäÈë12345£¬È»ºó»Ø³µ¼´¿É½øÈëµ½mysqlÖÐÁË£¬mysqlµÄÌáʾ·ûÊÇ£º
mysql>
×¢Ò⣬Èç¹ûÊÇÁ¬½Óµ½ÁíÍâµÄ»úÆ÷ÉÏ£¬ÔòÐèÒª¼ÓÈëÒ»¸ö²ÎÊý-h»úÆ÷IP
µ ......

MySQL Java ¿ª·¢Ì××°

MySQL Java ¿ª·¢Ì××°(·þÎñÆ÷,¹ÜÀí¹¤¾ß,JDBCÇý¶¯,ʾÀý´úÂë)
С¸üÐÂ: ΪÁ˼õÇḺµ£, Óà MySQL-Front 2.5 À´¹ÜÀí, Õâ¸öÈí¼þÎÞÖÐÎÄÎÊÌâ. Èç¹ûÒÔºó¿ªÔ´°æ±¾HeidiSQLµÄ½â¾öÁËÖÐÎÄÎÊÌâ, ¾ÍÓÿªÔ´µÄ.
ÏÂÔØ: http://tomcatmonitor.googlecode.com/files/portable_mysql5.exe  4.02MB (×Ô½âѹ°ü)
²Î¿¼Îĵµ: MySQL 5 ÂÌÉ« ......

MySQL ´¥·¢Æ÷ ´æ´¢¹ý³Ì Ò»µãСÓÃ

      Í¬ÊÂÀëÖ°£¬ÓÖÒ»¸öÒ»¸öÀÃ̯×ÓÒªÊÕÊ°¡£ÕâÀïÐÞÐÞ£¬ÄÇÀï²¹²¹¶¼Ã»Óо«Á¦À´Ð´µã¶«Î÷¡£
      Ã÷Ìì»Ø¼Ò£¬ÉÏÎçÕûÀíºÃÎĵµ¡£ÏÂÎç¾ö¶¨³éµãʱ¼ä£¬°Ñ×î½üµÄ¶«Î÷¾¡Á¿ÀíÒ»Àí¡£ºÜ¶àÁé¸Ð¶¼ÒѾ­ÒÅÍü¡£ÎÒÃÇ×ÜÔÚ²»¶ÏÃæ¶Ô£¬ËùÒÔÎÒÃDz»¶ÏÒÅÍü¡£¡¾syslog¡¢mysqlÓÅ»¯¡¢´¥·¢Æ÷¡¢´æ´¢ ......

MYSQL ɾ³ýͬһ±íÖÐÖظ´¼Ç¼

MYSQL ɾ³ýͬһ±íÖÐÖظ´¼Ç¼
CREATE TABLE `user` (
  `db_id` varchar(255) NOT NULL,
  `name` varchar(45) default NULL,
  `age` int(10) unsigned NOT NULL,
  `address` varchar(45) default NULL,
  PRIMARY KEY  (`db_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ