List:General Discussion« Previous MessageNext Message »
From:Opec Kemp (Ozlinx) Date:June 14 1999 2:44pm
Subject:Re: socket problem with DBI connection
View as plain text  
> Hello !
>
> Thanks for response but I think I don't really understand how mysql uses
> sockets.
> I didn't change the 3306 port (i'm sure because my win ODBC is configured
to
> use it and it works)
> But I know that safe_mysqld script starts mysqld with param
>
> --socket=/tmp/.my.socket
>
> (this cannot be changed with my permissions)
> when I want to use mysql shell I must start it like this:
>
> mysql --socket=/tmp/.my.socket
>
> (without --socket i get "Can't connect to local MySQL server")
>
> So, how can I do it in DBI ??
>
> I'll be very thankful for response because it's a serious problem to me.
> Chris.
Hi
Same as previous response :). In you pler script you should have as follow

use DBI;
$dbh=DBI->connect( "DBI:mysql:dbname=dbname:port", "dbusername",
"dbpassword");

This will return the DB handle in $dbh. You will then use this handle to
perform whatever query u want to this particular DB.
Replace port with the port number. To find yout which port MySQL is running
at you could do

mysqladmin -u yourusername -p variables

You will then be prompted  by the password challange. If you have access
then you will see the list of  MySQL vairables.
The variable you are looking for is
port
Put the value u found here in
DBI->connect("DBI:mysql:dbname=dbname:port_number_you_found_here",
"dbusername", "dbpassword");

If you do not understand DBI then goto this URL:
http://www.symbolstone.org/technology/perl/DBI/index.html it contains doc on
DBI.

Opec



Thread
socket problem with DBI connectionKrzysztof Wysocki14 Jun
  • Re: socket problem with DBI connectionOzemail)14 Jun
Re: socket problem with DBI connectionOzlinx)14 Jun
  • Re: socket problem with DBI connectionPaul DuBois14 Jun