Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 31, 2026.

Mysql error? Help... please! lol

Namecheap AuctionsNamecheap Auctions
NamecheapNamecheap
SpaceshipSpaceship
Watch

PoorDoggie

Soon to be RICHdoggie!VIP Member
Impact
18
Hi. When I run one of my scripts I keep getting the mysql error:

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

What does this mean, and why am I getting it? the mysql server is NOT local, the total opposite acctually!

Please help :wave:

Thanks in advance
Tom
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
0
Close
It basically means that the mysql server is down. It would be a problem with the hosts server and not the site.
 
0
Close
but another script using the mysql server is running properly.

It is basically a blog script, and the "add-entry.php" page works, and adds the data, but the view script isn't working! :(

thanks for the help ;)
Tom
 
0
Close
can you post the code to the one that isnt working properly?
 
0
Close
are the two scripts running off one config line?

or do you define the user/password each time?
 
0
Close
adam_uk said:
are the two scripts running off one config line?

or do you define the user/password each time?
they both use the same config file which has the password, db username and db name in it (+ host and whatever else). But they both connect independantly.

here is the code for index.php (the one that pulls the news from the database):
PHP:
<?php

// set your database infomation.
include("config.php");

// connect to the mysql database server.
$connect = mysql_connect($dbhost, $dbusername, $dbuserpass);
			
// select the database
mysql_select_db($dbname, $connect);

// Retrieve all the data from the "tutorials" table
$sql = "SELECT * FROM news";
$result = mysql_query( $sql );

// this gets the next row until there are no more to get
if( mysql_query( $sql ) ){
	?>
		<table width="100%">
			<tr>
				<th width="100%" colspan="2">Admin Section - News</th>
			</tr>
	<?php
	while($row = mysql_fetch_array( $result )) {
		?>
			<tr>
				<td colspan="2">
					<h3><?php echo $row['title']; ?></h3><br />
					<?php echo $row['news']; ?><br />
					<small>Created: <?php echo $row['date']; ?></small><br />
				</td>
			</tr>
			<tr>
				<td width="50%" align="center"><a href="edit.php?news_title=<?php echo $row['title']; ?>">EDIT THIS ENTRY</a></td>
				<td width="50%" align="center"><a href="delete.php?news_title=<?php echo $row['title']; ?>">DELETE THIS ENTRY</a></td>
			</tr>
		<?php
	}
	?>
		</table>
	<?php
}
else
{
	echo "No News - If this seems to be a mistake, please contact <a href='mailto:[email protected]?subject=News%20Script'>the webmaster</a><br /><br />";
	die(mysql_error());
}
?>
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back