Hello,
I am trying to query a MySQL database on a Linux box from a WNT 4.0 SP6
box. I get this error in my WNT perl script:
Error 1130. Could not connect to database,
DBI:mysql:database=as400;host=search400. Host '10.9.8.8' is not allowed to
connect to this MySQL server
Here are the facts:
My WNT client node is CACAW8428, ip address 10.9.8.8
I have installed Perl623 with DBI module version, 1.14, DBD-mysql module
version, 2.04
I am running MySQL 3.22.32. on Linux (Red Hat) server.
The host node is search400, ip address 10.9.14.9
The database name is as400.
I have added entries to three MySQL database tables, host, db and user as
such:
host table:
Host Db Select_priv Insert_priv Update_priv Delete_priv
Create_priv Drop_priv
Grant_priv
References_priv Index_priv Alter_priv
CACAW8428 as400 Y Y Y Y Y Y Y Y Y Y
db table:
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv
Drop_priv
Grant_priv References_priv
Index_priv Alter_priv
% test Y Y Y Y Y Y N Y Y Y
% test\_% Y Y Y Y Y Y N Y Y Y
CACAW8428 as400 paul Y Y Y Y Y Y Y Y Y Y
user table:
Host User Password Select_priv Insert_priv Update_priv
Delete_priv Create_priv
Drop_priv Reload_priv Shutdown_priv
Process_priv File_priv
Grant_priv References_priv
Index_priv Alter_priv
localhost root 6affb82d35c350d2 Y Y Y Y Y Y Y Y Y Y
Y Y Y Y
localhost.localdomain root Y Y Y Y Y Y Y Y Y Y Y
Y Y Y
localhost N N N N N N N N N N N N N N
localhost.localdomain N N N N N N N N N N N N
N N Edit Delete
CACAW8428 paul 174e380953808cd2 Y Y Y Y Y Y Y Y Y Y
Y Y Y Y
I start mysqld.exe on the Linux server with the --log parameter.
My WNT perl code is:
$hostname = "search400"; # node name is search400, IP address is
10.9.14.9
$database = "as400";
$user = "paul";
$password = "test01";
$driver = "mysql";
$dsn = "DBI:$driver:database=$database;host=$hostname";
$dbh = DBI->connect($dsn, $user, $password);
#
if (!$dbh)
{
$msg = "Error $DBI::err. Could not connect to database, $dsn.
$DBI::errstr";
print "$msg";
exit;
}
I have turned on the TRACE option using the code snippet,
DBI->trace(5);
The results from the trace are,
DBI 1.14-nothread dispatch trace level set to 5
-> DBI->connect(DBI:mysql:database=as400;host=search400, paul, ****)
-> connect for DBD::mysql::dr (DBI::dr=HASH(0x1d1caa4)~0x1cbdd8c
'database=as400;host=search400' 'paul' **** HASH(0x1cbdc9c))
New DBI::db (for DBD::mysql::db, parent=DBI::dr=HASH(0x1cbdd8c),
id=HASH(0x1cbdcfc))
dbih_setup_handle(DBI::db=HASH(0x1cbdd44)=>DBI::db=HASH(0x1cbc760),
DBD::mysql::db, 1d1f99c, HASH(0x1cbdcfc))
dbih_make_com(DBI::dr=HASH(0x1cbdd8c), DBD::mysql::db, 536)
dbih_setup_attrib(DBI::db=HASH(0x1cbc760), Err, DBI::dr=HASH(0x1cbdd8c))
SCALAR(0x1cd2cd8) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x1cbc760), State,
DBI::dr=HASH(0x1cbdd8c)) SCALAR(0x1d1cc78) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x1cbc760), Errstr,
DBI::dr=HASH(0x1cbdd8c)) SCALAR(0x1cd4250) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x1cbc760), Handlers,
DBI::dr=HASH(0x1cbdd8c)
) ARRAY(0x1cbdd14) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x1cbc760), Debug,
DBI::dr=HASH(0x1cbdd8c)) 0
(already defined)
imp_dbh->connect: dsn = database=as400;host=search400, uid = paul, pwd =
test01
imp_dbh->MyLogin: dbname = as400, uid = paul, pwd = test01,host = search400,
port = NULL
imp_dbh->MyConnect: host = search400, port = 0, uid = paul, pwd = test01
ERROR EVENT 1130 'Host '10.9.8.8' is not allowed to connect to this
MySQL se
rver' on DBI::db=HASH(0x1cbdd44)
Host '10.9.8.8' is not allowed to connect to this MySQL server error 1130
record
ed: Host '10.9.8.8' is not allowed to connect to this MySQL server
<> DESTROY ignored for outer handle DBI::db=HASH(0x1cbdd44) (inner
DBI::db=H
ASH(0x1cbc760))
-> DESTROY for DBD::mysql::db (DBI::db=HASH(0x1cbc760)~INNER)
DESTROY for DBI::db=HASH(0x1cbc760) ignored - handle not
initialised
<- DESTROY= undef at C:/Perl623/site/lib/DBD/mysql.pm line 132.
dbih_clearcom 0x1cbdd44 (com 0x1cbc0cc, type 2) done.
!! ERROR: 1130 'Host '10.9.8.8' is not allowed to connect to this MySQL
serv
er'
<- connect= undef at C:/Perl623/site/lib/DBI.pm line 408.
-> errstr in DBD::_::common for DBD::mysql::dr
(DBI::dr=HASH(0x1d1caa4)~0x1c
bdd8c)
<- errstr= 'Host '10.9.8.8' is not allowed to connect to this MySQL
server'
at C:/Perl623/site/lib/DBI.pm line 409.
DBI->connect(database=as400;host=search400) failed: Host '10.9.8.8' is not
allow
ed to connect to this MySQL server at d:\images\test.pl line 46
DBI->connect(database=as400;host=search400) failed: Host '10.9.8.8'
is no
t allowed to connect to this MySQL server
-> $DBI::err (*) FETCH from lasth=DBI::dr=HASH(0x1cbdd8c)
<- err= 1130
-> $DBI::errstr (&) FETCH from lasth=DBI::dr=HASH(0x1cbdd8c)
>> DBD::mysql::dr::errstr
Error 1130. Could not connect to database,
DBI:mysql:database=as400;host=search4
00. Host '10.9.8.8' is not allowed to connect to this MySQL server
-- DBI::END
-> disconnect_all for DBD::mysql::dr (DBI::dr=HASH(0x1d1caa4)~0x1cbdd8c)
<- disconnect_all= '' at C:/Perl623/site/lib/DBI.pm line 450.
-> DESTROY in DBD::_::common for DBD::mysql::dr
(DBI::dr=HASH(0x1cbdd8c)~INN
ER)
<- DESTROY= undef during global destruction.
dbih_clearcom 0x1d1caa4 (com 0x1ccf104, type 1) done.
<> DESTROY for DBI::dr=HASH(0x1d1caa4) ignored (inner handle gone)
I have some additional questions.
1. Is the node name entry in the db, host or user table case sensitive? Is
cacaw8428 different from CACAW8428? Should the entry be the IP address?
Should the entry be the full domain name, CACAW8428.can.apachecorp.com?
2. Is there a WNT executable called mysql.exe that is available to test the
user name and password in an interactive mode? Can I enter from a command
line in WNT,
mysql -u paul -ptest01 as400
3. Do I need to provide a specific port address in the connect call? Should
I use code such as
$port = "3306";
dsn = "DBI:$driver:database=$database;host=$hostname;port=$port";
4. Are there any additional Perl files other than the DBI and DBD-mysql perl
components needed?
5. How can I set up the MySQL database security such that I have a generic
user id that can access the MySQL server in read only fashion from any
remote node?
6. Does Linux need to have an access entry for the given client node?
Any help is much appreciated. I feel I am really close to making this work.
Thank you.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php