Jump to content


Photo

MySQL 5 possible problems.


  • Please log in to reply
5 replies to this topic

#1 Isidore

Isidore
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 12 March 2006 - 08:33 PM

I run a site that was recently upgraded to MySQL 5 (last week). Now this very simple script won't run:

<?php

echo '<p>before connection</p>';


$please_connect = 1;

if ($please_connect == 1){

  mysql_connect ("localhost", "username", "pass") or die(mysql_error());
  mysql_select_db ("dbname");

} else {

  echo '<p>you did not ask to connect.</p>';
  
}

echo '<p>after connection</p>';

?>

If $please_connect is set, then there is no output, and no error. If not, then everything prints properly.

I notice that there is a new setting in 5 regarding strict mode. Would this be the culprit?

It's very strange, because the site has partial availability-- some pages and the stylesheet seem to be unavaialble, but other things are still there.

I'm very perlplexed.:(

#2 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 12 March 2006 - 10:17 PM

Try resetting your password using:
SET PASSWORD FOR youruser@localhost = OLD_PASSWORD('yourpw')
See this for more information:

[a href=\"http://dev.mysql.com/doc/refman/5.0/en/php.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/5.0/en/php.html[/a]



#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 12 March 2006 - 10:27 PM

The old pasword issue is from 4.0 to 4.1+ -- but that usually results in a "client doesn't support authentication" error. So if there's no error, there's something else going on here.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#4 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 12 March 2006 - 10:38 PM

Some people upgrade from 4.0 to 5.0, but you're right, it should be spitting out an error.

Something must be crashing the thread because it should be printing the "after connection" part no matter what.

#5 Isidore

Isidore
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 13 March 2006 - 12:52 AM

[!--quoteo(post=354331:date=Mar 12 2006, 06:38 PM:name=wickning1)--][div class=\'quotetop\']QUOTE(wickning1 @ Mar 12 2006, 06:38 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Some people upgrade from 4.0 to 5.0, but you're right, it should be spitting out an error.

Something must be crashing the thread because it should be printing the "after connection" part no matter what.
[/quote]

That's the not-so-funny part. It doesn't even print the stuff before the connection.

And that old password stuff, this is on a shared host that uses cPanel, so setting the password isn't a problem.

Thanks for your help.

#6 wickning1

wickning1
  • Members
  • PipPipPip
  • Advanced Member
  • 405 posts

Posted 13 March 2006 - 01:28 AM

Let's try this and see what happens. Put "error_reporting(E_ALL);" at the top of your script, and remove the "or die()" from the mysql_connect() call.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users