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

Mysql error? Help... please! lol

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
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
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
0
•••
It basically means that the mysql server is down. It would be a problem with the hosts server and not the site.
 
0
•••
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
•••
can you post the code to the one that isnt working properly?
 
0
•••
are the two scripts running off one config line?

or do you define the user/password each time?
 
0
•••
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
•••
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back