Wednesday, October 7, 2009

Recover MySQL Database root password

If you have set the password for root and forget or unable to recall the password, then you will need to reset the root password for MySQL.
Login as root to the Unix-like (Unix, Linux or BSD) machine with the MySQL server.

Stop the MySQL server by using either of the following command

#/etc/init.d/mysql stop

Now you need to Start MySQL server without password

# mysqld_safe --skip-grant-tables &

Connect to mysql server using mysql client with the following command

# mysql -u root

Now you should be having mysql prompt

mysql>

Now you need to Setup new MySQL root user password

mysql> use mysql;

mysql> update user set password=PASSWORD(”newrootpassword”) where user=’root’;

mysql> flush privileges;

mysql> quit

Note: Replace newrootpassword with the new root password for MySQL server. Flush Privileges is needed to making the password change effect immediately.

Now you need to Stop MySQL Server using the following command

# /etc/init.d/mysql stop

Test Your New Mysql root password

First you need to start mysql server using the following command

# /etc/init.d/mysql start

# mysql -u root -p

Now it will prompt for root password and enter your new root password.


Taken from: http://www.debianadmin.com/recover-mysql-database-root-password.html

Ubuntu version

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 9.04
Release: 9.04
Codename: jaunty

Thursday, August 20, 2009

Playing with DATE and FOR in XP DOS

@echo off

rem for /F "tokens=1-4 delims=/ " %%i in ('date /t') do set dow=%%i && set month=%%j && set day=%%k && set year=%%l
rem for /F "tokens=1-4 delims=/ " %%i in ('date /t') do set dow=%%i && set date=%%j-%%k-%%l
rem for /F "tokens=2-4 delims=/ " %%i in ('date /t') do set date=%%i-%%j-%%k

for /F "tokens=1-4 delims=/ " %%i in ("%DATE%") do (
set dow=%%i
set dom=%%j-%%k-%%l
set month=%%j
set day=%%k
set year=%%l
)

set datew=%DATE:~0,3%
set datem=%DATE:~4,2%-%DATE:~7,2%-%DATE:~10,4%
set daten=%month%.%day%.%year%

echo %dow%
echo %datew%
echo %datem%
echo %daten%

Friday, July 10, 2009

UDP server in Perl

#!/usr/bin/perl

use strict;
use warnings;

use IO::Socket::INET;
use IO::Handle;

if ($#ARGV <>
die "Argument should be an integer port number\n";
} elsif ($ARGV[0] =~ /\D+/) {
die "Argument should be an integer port number\n";
}

my $Port = $ARGV[0];

my $MySocket = new IO::Socket::INET->new(
LocalPort => $Port,
Proto => 'udp'
) or die "Error opening UDP port $Port $!\n";

print "\nListening on UDP port $Port ...\n\n";

my $MsgText;

open(FILE, ">>udpserver.txt") or die "Error opening udpserver.txt file $!\n";
FILE->autoflush(1);
$MySocket->autoflush();

my $count = 1;
while ($MySocket->recv($MsgText, 4096)) {
print "$count <$MsgText>\n";
print FILE "$count <$MsgText>\n";
$count++;
}

close(FILE);

__END__

Wednesday, June 24, 2009

AnkhSVN

Subversion for Visual Studio

AnkhSVN is a Subversion SourceControl Provider for Visual Studio. The software allows you to perform the most common version control operations directly from inside the Microsoft Visual Studio IDE. With AnkhSVN you no longer need to leave your IDE to perform tasks like viewing the status of your source code, updating your Subversion working copy and committing changes. You can even browse your repository and you can plug-in your favorite diff tool.

AnkhSVN is an active open source project with multiple committers from around the world (including CollabNet).

The site is: http://ankhsvn.open.collab.net/