[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Perl/CGI -> mySQL



Thanks, but it ended up being the user permissions within the database
itself.

Richard

Paul Senzee wrote:
> 
> Hi Richard,
> 
> If it runs by hand & not through CGI, could it be possible that is a
> permissions problem -- do you need to chmod on your database files?
> 
> Paul Senzee
> -----Original Message-----
> From: Richard E. Perlotto II <richard@xxxxxxxxxxxx>
> To: cobalt-users@xxxxxxxxxxxxxxx <cobalt-users@xxxxxxxxxxxxxxx>
> Date: Saturday, January 29, 2000 1:15 AM
> Subject: [cobalt-users] Perl/CGI -> mySQL
> 
> >I am having a perplexing issue.  I have a perl script that is trying
> >to access a mySQL database.  If I run the perl code that accesses
> >the database by itself, it works, but if I run it through a CGI program
> >it does not.  The code is identical between the two programs where the
> >database access is being attempted.
> >
> >I ran all the recommended tests from http://www.mysql.org to insure that
> the
> >database is accessible via the network, and it is.  The tests were:
> >
> >mysqladmin -p version
> >mysqladmin -p variables
> >mysqladmin -p -h `hostname` version variables
> >mysqladmin -p -h `hostname` --port=3306 version
> >mysqladmin -p --socket=/var/lib/mysql/mysql.sock version
> >
> >I have even tried running a level 9 DBI trace as follows (and I know that
> there is a username
> >and password listed in the output):
> >
> >    DBI dispatch debug level set to 9
> >    dbih_setup_handle(DBI::dr=HASH(0x10197d10)=>DBI::dr=HASH(0x101e4494),
> DBD::mysql::dr, 0, Null!)
> >    dbih_make_com(Null!, DBD::mysql::dr, 72)
> >    >> connect     DISPATCH (DBI::dr=HASH(0x10197d10) rc1/3 @5 g0
> a101be4b8)
> >    -> connect for DBD::mysql::dr (DBI::dr=HASH(0x10197d10)~0x101e4494
> 'test_db' 'username' 'password' HASH(0x101309bc))
> >    dbih_setup_handle(DBI::db=HASH(0x101e4524)=>DBI::db=HASH(0x101e44dc),
> DBD::mysql::db, 10197b60, Null!)
> >    dbih_make_com(DBI::dr=HASH(0x101e4494), DBD::mysql::db, 416)
> >imp_dbh->connect: dsn = test_db, uid = username, pwd = password
> >    ERROR EVENT 2002 'Can't connect to local MySQL server' (Handlers:
> undef)
> >Can't connect to local MySQL server error 2002 recorded: Can't connect to
> local MySQL server
> >    >> DESTROY     DISPATCH (DBI::db=HASH(0x101e4524) rc1/1 @1 g0 a0)
> >       (outer handle DESTROY ignored)
> >    >> DESTROY     DISPATCH (DBI::db=HASH(0x101e44dc) rc1/1 @1 g0 a0)
> >    -> DESTROY for DBD::mysql::db (DBI::db=HASH(0x101e44dc))
> >    <- DESTROY= undef
> >    dbih_clearcom (h 0x101e44dc, com 0x101df590):
> >       FLAGS 0x11: COMSET Warn
> >       TYPE 2
> >       PARENT DBI::dr=HASH(0x101e4494)
> >       KIDS 0 (0 active)
> >       IMP_DATA undef in 'DBD::mysql::db'
> >    dbih_clearcom 0x101e44dc (com 0x101df590, type 2) done.
> >
> >    <- connect= undef
> >    !! ERROR: 2002 'Can't connect to local MySQL server'
> >    >> errstr      DISPATCH (DBI::dr=HASH(0x10197d10) rc1/3 @1 g1
> a101bded8)
> >    -> errstr in DBD::_::common for DBD::mysql::dr
> (DBI::dr=HASH(0x10197d10)~0x101e4494)
> >    <- errstr= ( 'Can't connect to local MySQL server' ) [1 items]
> >    >> disconnect_all DISPATCH (DBI::dr=HASH(0x10197d10) rc1/3 @1 g0
> a101bdc50)
> >    -> disconnect_all for DBD::mysql::dr
> (DBI::dr=HASH(0x10197d10)~0x101e4494)
> >    <- disconnect_all= ''
> >    >> DESTROY     DISPATCH (DBI::dr=HASH(0x101e4494) rc1/1 @1 g0 a0)
> >    -> DESTROY in DBD::_::common for DBD::mysql::dr
> (DBI::dr=HASH(0x101e4494))
> >    <- DESTROY= undef
> >    dbih_clearcom (h 0x101e4494, com 0x101e0ca8):
> >       FLAGS 0x215: COMSET Active Warn AutoCommit
> >       TYPE 1
> >       PARENT undef
> >       KIDS 0 (0 active)
> >       IMP_DATA undef in 'DBD::mysql::dr'
> >    dbih_clearcom 0x101e4494 (com 0x101e0ca8, type 1) done.
> >
> >    >> DESTROY     DISPATCH (DBI::dr=HASH(0x10197d10) rc1/1 @1 g0 a0)
> >       (inner handle already deleted)
> >
> >
> >Here is one that worked from the hand run perl program:
> >
> >   DBI dispatch debug level set to 9
> >    dbih_setup_handle(DBI::dr=HASH(0x1013e258)=>DBI::dr=HASH(0x10100288),
> DBD::mysql::dr, 0, Null!)
> >    dbih_make_com(Null!, DBD::mysql::dr, 72)
> >    >> connect     DISPATCH (DBI::dr=HASH(0x1013e258) rc1/3 @5 g0
> a10164df8)
> >    -> connect for DBD::mysql::dr (DBI::dr=HASH(0x1013e258)~0x10100288
> 'test_db' 'username' 'password' HASH(0x100d4b08))
> >    dbih_setup_handle(DBI::db=HASH(0x101002e8)=>DBI::db=HASH(0x1015e6e4),
> DBD::mysql::db, 1013e0a8, Null!)
> >    dbih_make_com(DBI::dr=HASH(0x10100288), DBD::mysql::db, 416)
> >imp_dbh->connect: dsn = test_db, uid = username, pwd = password
> >    <- connect= DBI::db=HASH(0x101002e8)
> >    >> STORE       DISPATCH (DBI::db=HASH(0x1015e6e4) rc2/1 @3 g0 a0)
> >    -> STORE for DBD::mysql::db (DBI::db=HASH(0x1015e6e4) 'PrintError' 1)
> >    STORE DBI::db=HASH(0x1015e6e4) 'PrintError' => 1
> >    <- STORE= 1
> >    >> STORE       DISPATCH (DBI::db=HASH(0x1015e6e4) rc2/1 @3 g0 a0)
> >    -> STORE for DBD::mysql::db (DBI::db=HASH(0x1015e6e4) 'RaiseError' 1)
> >    STORE DBI::db=HASH(0x1015e6e4) 'RaiseError' => 1
> >    <- STORE= 1
> >
> >The error from the web is:
> >
> >Software error:
> >
> >Can't connect to local MySQL server at
> /home/sites/common/modules/prefix_suffix.pm line 217
> >
> >It does not seem to matter how I code the perl, I cannot access the
> >database.  I even downloaded several other programs that attempt to
> >access a mySQL database via perl CGI scripts, and none of them work
> >either.
> >
> >Does anyone have an idea where it is not working?
> >
> >
> >Richard
> 
> _______________________________________________
> cobalt-users mailing list
> cobalt-users@xxxxxxxxxxxxxxx
> http://list.cobalt.com/mailman/listinfo/cobalt-users
begin:vcard 
n:Perlotto;Richard
x-mozilla-html:FALSE
url:http://www.perlotto.com
org:Home
adr:;;;;;;
version:2.1
email;internet:richard@xxxxxxxxxxxx
x-mozilla-cpt:;-1
fn:Richard Perlotto
end:vcard