use DBI; $drh = DBI->install_driver("mysql"); $database ='testg1'; $host ="localhost"; $user = "root"; $password = "passowrd"; $rc = $drh->func('createdb', $database, $host, $user, $password, 'admin'); if ($rc == 1){print"new database created.."; } else{print "could not create database: $DBI::errstr\n";} ##################################### ######database created successfully ##################################### #################################### ### the following segment is giving problem ##################################### # the datasource $dbname = 'testg1'; my $db="$dbname:164.xxx.x.xxx:yyyy"; my $dbh = DBI->connect("DBI:mysql:$db",$user,$password) or die("cant connect\n"); print "connected"; ########################################### ###### because of the error, i dont reach the following ##segment ############################################ $auser = 'newuser@localhost'; $pw = 'abcd'; my $query = qq|GRANT ALL on $db.* TO ? IDENTIFIED BY ?|; $dbh->do($query,undef,$auser,$pw) || die ("Could not do $query - Error: $DBI::errstr"); ########################################### #### DBI->connect(testg1:164.xxx.x.xxx:yyyy) failed: Access denied for user: 'root@myhost' (Using password: YES) at create.pl line 19 cant connect