Can''t access MySQL database
Posted by: marvinlevin (---.mslcs.com)
Date: December 08, 2012 09:57PM

Re-installed WampServer (32 bits & PHP 5.3) 2.2E - now I cannot access database from PHP-based app.

App is mrbs - Meeting Room Booking System from SourceForge.

I can access the database from within PHPMyAdmin. but when the app attempts to connect with sql-pconnect, I get Access denied for User. This used to work and I'm stumped trying to figure out what's changed.

Any suggestions?

Options: ReplyQuote
Re: Can''t access MySQL database
Posted by: RiggsFolly (---.as13285.net)
Date: December 09, 2012 11:05AM

You probably forgot to add the apps Userid and Password to mysql and give privileges to that user on your apps database.

Options: ReplyQuote
Re: Can''t access MySQL database
Posted by: Ramesh (117.228.154.---)
Date: December 20, 2012 08:03AM

sir...
code is:


<html>
<head>
<title>Connecting MySQL Server</title>
</head>
<body>
<?php
$dbhost = 'localhost';
$dbuser = '';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';

$sql = 'CREATE DATABASE TUTORIALS';
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
die('Could not create database: ' . mysql_error());
}
echo "Database TUTORIALS created successfully\n";
mysql_close($conn);
?>
</body>
</html>

output:

Connected successfullyCould not create database: Access denied for user ''@'localhost' to database 'tutorials'



how to allow localhost to create database...

thanks in advance.

Options: ReplyQuote
Re: Can''t access MySQL database
Posted by: RiggsFolly (---.as13285.net)
Date: December 20, 2012 04:09PM

You need to put a userid into
$dbuser = '';


If you are using WAMP straight out of the box then you can use the default userid which is 'root'

So change $dbuser = ''; to $dbuser = 'root';



Maybe you should try reading this before you go much further

[forum.wampserver.com]

Options: ReplyQuote


Sorry, only registered users may post in this forum.