Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 28th, 2001, 11:25 AM
jouster jouster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Ann Arbor, MI
Posts: 0 jouster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question

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!

Reply With Quote
  #2  
Old March 28th, 2001, 11:51 AM
meeh82 meeh82 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: Riverside, CA
Posts: 63 meeh82 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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

Reply With Quote
  #3  
Old March 28th, 2001, 12:02 PM
jouster jouster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Ann Arbor, MI
Posts: 0 jouster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #4  
Old March 28th, 2001, 02:00 PM
meeh82 meeh82 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: Riverside, CA
Posts: 63 meeh82 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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?

Reply With Quote
  #5  
Old March 28th, 2001, 02:11 PM
jouster jouster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Ann Arbor, MI
Posts: 0 jouster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
YES

Yes, I connected through telnet and created my table and inserted some test information. That all worked fine.

Reply With Quote
  #6  
Old March 28th, 2001, 03:08 PM
dsb dsb is offline
PerlGuy
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2001
Posts: 714 dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 15 h 44 m 20 sec
Reputation Power: 36
Send a message via AIM to dsb
Wink

Do your scripts reside on the ISP's server or on your desktop computer?
__________________
- dsb -
Perl Guy

Reply With Quote
  #7  
Old March 28th, 2001, 03:13 PM
meeh82 meeh82 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: Riverside, CA
Posts: 63 meeh82 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
put localhost on your scripts

on your scripts, put localhost in place of the server name they gave you. This might resolve the problem.

Reply With Quote
  #8  
Old March 28th, 2001, 03:20 PM
jouster jouster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Ann Arbor, MI
Posts: 0 jouster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking I will try that.

They reside on the server in my cgi-bin. I will try the localhost.
Cross your fingers.....

Reply With Quote
  #9  
Old March 28th, 2001, 04:21 PM
jouster jouster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Ann Arbor, MI
Posts: 0 jouster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Aww shucks

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.

Reply With Quote
  #10  
Old March 28th, 2001, 04:27 PM
dsb dsb is offline
PerlGuy
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2001
Posts: 714 dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 15 h 44 m 20 sec
Reputation Power: 36
Send a message via AIM to dsb
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'.

Reply With Quote
  #11  
Old March 29th, 2001, 07:37 AM
jouster jouster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Ann Arbor, MI
Posts: 0 jouster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Still no luck

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)

Reply With Quote
  #12  
Old March 29th, 2001, 10:27 AM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
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).

Reply With Quote
  #13  
Old March 30th, 2001, 01:20 PM
jouster jouster is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: Ann Arbor, MI
Posts: 0 jouster User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation I finally connected

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?

Reply With Quote
  #14  
Old March 30th, 2001, 05:20 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 10
Might mean that, but as long as you can now use Mysql, that's what's important.

Reply With Quote
  #15  
Old April 1st, 2001, 05:02 AM
akashani akashani is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 0 akashani User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Yet another Perl DBI MYSQL problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump