Access denied for user 'administrator'@'localhost' (using password: NO)
Here is my PHP:
CODE
<?php
//this script connects to the mysql server database
$username = 'administrator';//stores the username
$password = "********";//stores the password
if ($dbc = mysql_connect('127.0.0.1', $username, $password)) {
print '<p>Successfully connected to the MySQL!</p>'; //print a message if it was a success
mysql_close(); // close the database
if (@mysql_query('CREATE DATABASE myblog')) {//Try to create the database
print '<p>The database has been created!</p>';//Creating the database was successful
} else {
print '<p style="color: red;">Could not create the database because:<br />;' . mysql_error() . '</p>';
}
if (@mysql_select_db('myblog')) {
print '<p>Database has been selected!</p>';
} else {
print '<p style="color:red;">Could not select the database because:<br />' . mysql_error() . '</p>';
}
} else { //connection failed
print '<p style="color:red;">Could nor connect to MySQL:<br />' . mysql_error() . "</p>";
}
?>
//this script connects to the mysql server database
$username = 'administrator';//stores the username
$password = "********";//stores the password
if ($dbc = mysql_connect('127.0.0.1', $username, $password)) {
print '<p>Successfully connected to the MySQL!</p>'; //print a message if it was a success
mysql_close(); // close the database
if (@mysql_query('CREATE DATABASE myblog')) {//Try to create the database
print '<p>The database has been created!</p>';//Creating the database was successful
} else {
print '<p style="color: red;">Could not create the database because:<br />;' . mysql_error() . '</p>';
}
if (@mysql_select_db('myblog')) {
print '<p>Database has been selected!</p>';
} else {
print '<p style="color:red;">Could not select the database because:<br />' . mysql_error() . '</p>';
}
} else { //connection failed
print '<p style="color:red;">Could nor connect to MySQL:<br />' . mysql_error() . "</p>";
}
?>
Successfully connected to the MySQL!
Could not create the database because:
;Access denied for user 'administrator'@'localhost' (using password: NO)
Could not select the database because:
Access denied for user 'administrator'@'localhost' (using password: NO)
