Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Connecting to MySQL

by RazorbladeBidet (Friar)
on Apr 14, 2005 at 12:57 UTC ( #447748=note: print w/replies, xml ) Need Help??


in reply to Connecting to MySQL

Can you try starting a trace?

I've worked with DBI to MySql before but unfortunately cannot replicate your situation. Perhaps someone with a working example can help more, but let's see what we can find out from the trace.
--------------
"But what of all those sweet words you spoke in private?"
"Oh that's just what we call pillow talk, baby, that's all."

Replies are listed 'Best First'.
Re^2: Connecting to MySQL
by davies (Prior) on Apr 15, 2005 at 13:29 UTC
    OK, the code now looks like this:
    use strict; use DBI; use warnings; use diagnostics; my $sqlhost = 'localhost'; my $sqlbase = 'debloat'; my $user = 'JHD'; my $password = 'JHD'; DBI->trace(5); my $dbh = DBI->connect( "DBI:mysql:database=$sqlbase;host=$sqlhost;port=3306", $user, $password); exit (0);
    I don't know if trace level 5 is appropriate. If you want me to re-run at another level, just say the word. I removed the "RaiseError" setting as it didn't seem to help, and put the port in because the traces were showing the port as 0, and I just hoped that it might be something to do with that. I don't think it is, but it does seem to have cut down slightly on the length of the trace output. The output is:
    DBI 1.48-ithread default trace level set to 0x0/5 (pid 1448) -> DBI->connect(DBI:mysql:database=debloat;host=localhost;port=330 +6, JHD, ** **) -> DBI->install_driver(mysql) for MSWin32 perl=5.008004 pid=1448 r +uid=0 euid =0 install_driver: DBD::mysql version 2.9004 loaded from C:/Perl/s +ite/lib/DB D/mysql.pm New DBI::dr (for DBD::mysql::dr, parent=, id=) dbih_setup_handle(DBI::dr=HASH(0x1b61a24)=>DBI::dr=HASH(0x1c63324) +, DBD::mys ql::dr, 0, Null!) dbih_make_com(Null!, 0, DBD::mysql::dr, 84, 0) thr#15d4064 dbih_setup_attrib(DBI::dr=HASH(0x1c63324), Err, Null!) SCALAR(0x1c +4a3cc) (al ready defined) dbih_setup_attrib(DBI::dr=HASH(0x1c63324), State, Null!) SCALAR(0x +1b64d78) ( already defined) dbih_setup_attrib(DBI::dr=HASH(0x1c63324), Errstr, Null!) SCALAR(0 +x1b19f9c) (already defined) dbih_setup_attrib(DBI::dr=HASH(0x1c63324), TraceLevel, Null!) 0 (a +lready def ined) dbih_setup_attrib(DBI::dr=HASH(0x1c63324), FetchHashKeyName, Null! +) 'NAME' ( already defined) <- install_driver= DBI::dr=HASH(0x1b61a24) !! warn: 0 CLEARED by call to connect method -> connect for DBD::mysql::dr (DBI::dr=HASH(0x1b61a24)~0x1c63324 ' +database=d ebloat;host=localhost;port=3306' 'JHD' **** HASH(0x1c65bf8)) thr#15d40 +64 New DBI::db (for DBD::mysql::db, parent=DBI::dr=HASH(0x1c63324), i +d=HASH(0x1 bfc33c)) dbih_setup_handle(DBI::db=HASH(0x1c4a294)=>DBI::db=HASH(0x1b1abcc) +, DBD::mys ql::db, 1b5d96c, HASH(0x1bfc33c)) dbih_make_com(DBI::dr=HASH(0x1c63324), 1c373d4, DBD::mysql::db, 60 +0, 0) thr# 15d4064 dbih_setup_attrib(DBI::db=HASH(0x1b1abcc), Err, DBI::dr=HASH(0x1c6 +3324)) SCA LAR(0x1b65120) (already defined) dbih_setup_attrib(DBI::db=HASH(0x1b1abcc), State, DBI::dr=HASH(0x1 +c63324)) S CALAR(0x1b6603c) (already defined) dbih_setup_attrib(DBI::db=HASH(0x1b1abcc), Errstr, DBI::dr=HASH(0x +1c63324)) SCALAR(0x1b6600c) (already defined) dbih_setup_attrib(DBI::db=HASH(0x1b1abcc), TraceLevel, DBI::dr=HAS +H(0x1c6332 4)) 0 (already defined) dbih_setup_attrib(DBI::db=HASH(0x1b1abcc), FetchHashKeyName, DBI:: +dr=HASH(0x 1c63324)) 'NAME' (already defined) dbih_setup_attrib(DBI::db=HASH(0x1b1abcc), HandleSetErr, DBI::dr=H +ASH(0x1c63 324)) undef (not defined) dbih_setup_attrib(DBI::db=HASH(0x1b1abcc), HandleError, DBI::dr=HA +SH(0x1c633 24)) undef (not defined) imp_dbh->connect: dsn = database=debloat;host=localhost;port=3306, uid + = JHD, pw d = JHD imp_dbh->MyLogin: dbname = debloat, uid = JHD, pwd = JHD,host = localh +ost, port = 3306 imp_dbh->mysql_dr_connect: host = localhost, port = 3306, uid = JHD, p +wd = JHD imp_dbh->mysql_dr_connect: client_flags = 2 imp_dbh->mysql_dr_connect: <-Client does not support authentication pr +otocol req uested by server; consider upgrading MySQL client error 1251 recorded: + Client do es not support authentication protocol requested by server; consider u +pgrading M ySQL client <> DESTROY(DBI::db=HASH(0x1c4a294)) ignored for outer handle (inne +r DBI::db= HASH(0x1b1abcc) has ref cnt 1) -> DESTROY for DBD::mysql::db (DBI::db=HASH(0x1b1abcc)~INNER) thr# +15d4064 DESTROY for DBI::db=HASH(0x1b1abcc) ignored - handle not init +ialised ERROR: 1251 'Client does not support authentication protocol re +quested by server; consider upgrading MySQL client' (err#0) <- DESTROY= undef at C:/Perl/site/lib/DBD/mysql.pm line 132 via pr +actice\sql test.pl line 12 dbih_clearcom 0x1c4a294 (com 0x1a48d34, type 2) done. !! ERROR: 1251 'Client does not support authentication protocol re +quested by server; consider upgrading MySQL client' (err#0) <- connect= undef at C:/Perl/site/lib/DBI.pm line 598 -> $DBI::errstr (&) FETCH from lasth=HASH >> DBD::mysql::dr::errstr <- $DBI::errstr= 'Client does not support authentication protocol +requested by server; consider upgrading MySQL client' DBI connect('database=debloat;host=localhost;port=3306','JHD',. +..) failed : Client does not support authentication protocol requested by server; + consider upgrading MySQL client DBI connect('database=debloat;host=localhost;port=3306','JHD',...) fai +led: Clien t does not support authentication protocol requested by server; consid +er upgradi ng MySQL client at practice\sqltest.pl line 12 -- DBI::END !! ERROR: 1251 CLEARED by call to disconnect_all method -> disconnect_all for DBD::mysql::dr (DBI::dr=HASH(0x1b61a24)~0x1c +63324) thr #15d4064 <- disconnect_all= (not implemented) at C:/Perl/site/lib/DBI.pm li +ne 677 via practice\sqltest.pl line 0 ! -> DESTROY in DBD::_::common for DBD::mysql::dr (DBI::dr=HASH(0x1c +63324)~INN ER) thr#15d4064 ! <- DESTROY= undef during global destruction dbih_clearcom 0x1b61a24 (com 0x1c373d4, type 1) done. ! <> DESTROY for DBI::dr=HASH(0x1b61a24) ignored (inner handle gone)

    I hope this makes more sense to you (or someone else) than it does to me. If there is a pointer that would make sense to a Perl newbie on how to interpret this, I would love to know about it, as it seems to be a useful technique.

    Thanks again for your help & advice,

    John Davies

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://447748]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2020-10-24 09:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (242 votes). Check out past polls.

    Notices?