|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am trying to connect to a MySQL database on my ISP server which I have access to.
I have read through all the posts from before and have tried thier suggestions to no avail. I keep getting a mysql.sock error (111). So i tried putting in the port number 3306 and I get a can't connect error (22). I cant find any documentation on these errors , if someone knows where I can find them I would appreciate it. I also noticed that some people are connecting using a MySQL module instead of the DBI. Where can I find infomation on this along with some documentation. At this point I'm willing to try about anything. Thanks! |
|
#2
|
|||
|
|||
|
how did they tell you to connect?
Did your isp tell you to connect to the mysql database using a certain server name, or are you using localhost?
Jonathan Donaghe |
|
#3
|
|||
|
|||
|
They gave me a server name
They gave me a server name and the name for my database, other than that I can't get any other information from them. They didn't even know what the DBI was. They told me if it was in the MySQL manual then it should work.
|
|
#4
|
|||
|
|||
|
It's not the DBI Packet
I came across the same message when I installed mysql on a linux server, it has something to do on their side, can you connect with the mysql client?
|
|
#5
|
|||
|
|||
|
YES
Yes, I connected through telnet and created my table and inserted some test information. That all worked fine.
|
|
#6
|
|||
|
|||
|
Do your scripts reside on the ISP's server or on your desktop computer?
__________________
- dsb - ![]() Perl Guy |
|
#7
|
|||
|
|||
|
put localhost on your scripts
on your scripts, put localhost in place of the server name they gave you. This might resolve the problem.
|
|
#8
|
|||
|
|||
|
They reside on the server in my cgi-bin. I will try the localhost.
Cross your fingers..... |
|
#9
|
|||
|
|||
|
The localhost didnt work either.
Here is my connect code: $DSN= "dbi:mysql:database=*mydb*;host=localhost"; my $dbh = DBI->connect($DSN,$user,$pass) || die print "$DBI::errstr\n"; I still get the var/lib/mysql.sock error(111) Any more suggestions would be appreciated. |
|
#10
|
|||
|
|||
|
The connect string should look like this:
Code:
$DSN = "DBI:mysql:mydb:localhost";
$dbh = DBI->connect( $DSN, $user, $pass ) ||
die "Connect Error: $DBI::errstr\n";
Try it again with 'localhost'. |
|
#11
|
|||
|
|||
|
I changed my code to:
$DSN = "DBI:mysql:mydb:localhost"; $dbh = DBI->connect( $DSN, $user, $pass ) || die "Connect Error: $DBI::errstr\n"; I still get this error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) |
|
#12
|
|||
|
|||
|
That means the MySql server isn't running (or you don't have permission to read the /var/lib/mysql/mysql.sock file -- which can happen in rare casses where your isp sets up mysql wrong).
|
|
#13
|
|||
|
|||
|
I was finally able to connect. I found an older post where someone said they used a Mysql module like so:
Use Mysql; #instead of DBI Does this mean my ISP has not updated thier DBD modules or what? |
|
#14
|
|||
|
|||
|
Might mean that, but as long as you can now use Mysql, that's what's important.
|
|
#15
|
|||
|
|||
|
When running the mysqld daemon, you can specify where the socket file is to reside (usually at /var/lib/mysql/mysql.sock.) The DBD::mysql driver (which is used when using DBI) looks for the socket file in it's default location. If it's not there, it can't communicate with the database.
You should find out where the socket file is, and specify it in your connect statement: Code:
my $dbh = DBI->connect("DATABASE;mysql_socket=/PATH/TO/SOCKET", "user", "pass", "mysql");
- Amir |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Yet another Perl DBI MYSQL problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|