Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
MySQL Connection Error
Old 02-29-2008, 02:26 PM MySQL Connection Error
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
Unsure of what this means and how to fix it.

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Any help please?
Gilligan is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-29-2008, 04:16 PM Re: MySQL Connection Error
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
I got that error once when my host's sql server was down temporarily. Check if that is the case otherwise:

http://www.google.com/search?hl=en&q...=Google+Search
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 02-29-2008, 04:45 PM Re: MySQL Connection Error
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
I can logon through phpmyadmin, so it can't be down i guess. And those google results don't really help me, i'm on a shared hosting package you see.
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 02-29-2008, 05:17 PM Re: MySQL Connection Error
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
This indicate that the script tries to conenct to a mysql server on a linux server LOCALLY

Quote:
i'm on a shared hosting package you see.
This tend to indicate that your server is not local, thus the connection error.

Look in your script documentation the connection settings, and accord the target server to the info your host should have given you.
The script is likely to try to connect to "localhost" or "127.0.0.1" (which is the local loopback network interface. It always refer to the computer itself, but through the network stack.)
__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 02-29-2008 at 05:19 PM..
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 02-29-2008, 06:12 PM Re: MySQL Connection Error
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
Not sure what you mean, my host didn't give me any information on MySQL databases.

Here's a php info page

Here's the MySQL Documentation

Sorry, like I said, kinda new with php.

Last edited by Gilligan; 02-29-2008 at 06:14 PM..
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 02-29-2008, 06:39 PM Re: MySQL Connection Error
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
Who is your host with?
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 02-29-2008, 06:44 PM Re: MySQL Connection Error
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
The point is, that the PHP script has to know where to connect to a db.
When the script runs on your host server, "localhost" referes to the server itself, which is where the database resides too 99% of time.

But, when you download the files to your computer, or a computer in your local network, the database is not repatriated, so the "localhost" is not the good database server anymore.

That's probably where your error lies.
You can either replace the occurences of "localhost" or "127.0.0.1" in the PHP mysql connect string to the IP of your server.
But it may fail if the mysql server is not configured to allow connection from another address than localhost.

Or you need to get a "dump" of the datas in your database, and to restore them on a mysql instance that will run on the same server as your files are on.
Then, "localhost" will refer a valid instance of the database agin.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 02-29-2008, 07:10 PM Re: MySQL Connection Error
joder's Avatar
Flipotron

Posts: 6,442
Name: James
Location: In the ocean.
Trades: 0
Look in your control panel for MySQL databases. Sounds like you may not have created a database on the host. If you have, the control panel will give you the information on connection parameters.
joder is offline
Reply With Quote
View Public Profile
 
Old 02-29-2008, 11:21 PM Re: MySQL Connection Error
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Quote:
Originally Posted by Gilligan View Post
I can logon through phpmyadmin, so it can't be down i guess. And those google results don't really help me, i'm on a shared hosting package you see.
Its entirely possible that you can have cpanel access and a fully functional site (other than the database problems) and at the same time have the mysql server down. I would if you still haven't figured it out you may want to just contact your host directly about the issue.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 03-01-2008, 05:53 AM Re: MySQL Connection Error
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
Quote:
Originally Posted by tripy View Post
Or you need to get a "dump" of the datas in your database, and to restore them on a mysql instance that will run on the same server as your files are on.
Then, "localhost" will refer a valid instance of the database agin.
How would I do this, and what is a mysql instance.

My hosts are webfusion, myserverworld.net.

I have contact my host support about the problem
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 03-01-2008, 07:24 AM Re: MySQL Connection Error
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Quote:
Definitions of instance on the Web:
case: an occurrence of something;
An Oracle Instance is a running Oracle Database made up of memory structures and background processes. An instance only exists while it is up and running. Simply put, a database resides on disk, while an instance resides in memory. ...
By instance, I was referring by a mysql server (the program, not the computer) running on the same computer that the one who have the files on, and with a web server (again, the program, not the hardware) up and running too.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 03-01-2008, 07:26 AM Re: MySQL Connection Error
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
So what exactly should i do, and how?
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 03-01-2008, 08:05 AM Re: MySQL Connection Error
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
i changed 'localhost' to 'mysql101' and it worked
Gilligan is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to MySQL Connection Error
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.42039 seconds with 12 queries