DIDD0
asked on
Access denied for user: '@localhost' to database 'myblog'
I am having a problem trying to connect with MySQL with PHP. I get this error. Access denied for user: '@localhost' to database 'myblog'
This is my code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
if ($dbc = mysql_connect('127.0.0.1', 'fizz', '************')) { // I covered my password
print '<P>Successfuly connected to MySQL.</P>';
mysql_close();
} else {
print '<p>Could not connect to MySQL.</p>';
}
if (@mysql_query ('CREATE DATABASE myblog')) {
print '<P>The Database has been created!</P>';
} else {
die ('<p>Could not create the database because: <b>' . mysql_error() . '</b></p>');
}
?>
</body>
</html>
END CODE
And as you can see in this screen shot: http://fizzmahon.2mydns.com/error.jpg
i have all the privaledges....
after running my code in a browser i get this...
-------
Successfuly connected to MySQL.
Could not create the database because: Access denied for user: '@localhost' to database 'myblog'
-------
and you can see it for yourself here: http://fizzmahon.2mydns.com/Temp/mysql.php
THANKS IN ADVANCED!!! IF YOU NEED ANY MORE INFO I CAN TELL YOU =D
FiZZ
This is my code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<?
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
if ($dbc = mysql_connect('127.0.0.1',
print '<P>Successfuly connected to MySQL.</P>';
mysql_close();
} else {
print '<p>Could not connect to MySQL.</p>';
}
if (@mysql_query ('CREATE DATABASE myblog')) {
print '<P>The Database has been created!</P>';
} else {
die ('<p>Could not create the database because: <b>' . mysql_error() . '</b></p>');
}
?>
</body>
</html>
END CODE
And as you can see in this screen shot: http://fizzmahon.2mydns.com/error.jpg
i have all the privaledges....
after running my code in a browser i get this...
-------
Successfuly connected to MySQL.
Could not create the database because: Access denied for user: '@localhost' to database 'myblog'
-------
and you can see it for yourself here: http://fizzmahon.2mydns.com/Temp/mysql.php
THANKS IN ADVANCED!!! IF YOU NEED ANY MORE INFO I CAN TELL YOU =D
FiZZ
ASKER
nope same error
<?
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
if ($dbc = mysql_connect('127.0.0.1', 'fizz', '************')) { // I covered my password
print '<P>Successfuly connected to MySQL.</P>';
mysql_close();
} else {
print '<p>Could not connect to MySQL.</p>';
}
mysql_query ("CREATE DATABASE myblog") or die (mysql_error());
?>
Can you post the error if you use this code... thanks
ini_set ('display_errors', 1);
error_reporting (E_ALL & ~E_NOTICE);
if ($dbc = mysql_connect('127.0.0.1',
print '<P>Successfuly connected to MySQL.</P>';
mysql_close();
} else {
print '<p>Could not connect to MySQL.</p>';
}
mysql_query ("CREATE DATABASE myblog") or die (mysql_error());
?>
Can you post the error if you use this code... thanks
ASKER
Successfuly connected to MySQL.
Access denied for user: '@localhost' to database 'myblog'
Access denied for user: '@localhost' to database 'myblog'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thats wierd... let me check
ASKER
Yes it is working now... but i didnt change anything?!?!?! all i did was install phpmyadmin...
anyways i will grant you points...
anyways i will grant you points...
thanks DIDD0 :) greatly appreciated ^_^
Well, good that it working for you :)
However, I did try the code I posted above locally and it worked.....
but on my MySQL, I use "root" as the user with a blank password.
However, I did try the code I posted above locally and it worked.....
but on my MySQL, I use "root" as the user with a blank password.
Regards
-r-