Trouble With PHP/MySQL, Permissions??? |
Trouble With PHP/MySQL, Permissions??? |
May 13 2009, 12:28 PM
Post
#1
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Official Member Posts: 1,574 Joined: Aug 2007 Member No: 555,438 |
The connection to the database is fine, however I keep getting the following error when I attempt to run a query:
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>"; } ?> 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) |
|
|
|
Uronacid Trouble With PHP/MySQL May 13 2009, 12:28 PM
mipadi Were you able to create the database? May 13 2009, 12:57 PM
Uronacid QUOTE(mipadi @ May 13 2009, 01:57 PM) Wer... May 13 2009, 01:08 PM
mipadi What versions of MySQL and PHP are you using? May 13 2009, 01:12 PM
Uronacid QUOTE(mipadi @ May 13 2009, 02:12 PM) Wha... May 13 2009, 01:14 PM
mipadi `php --version` and `mysql --version... May 13 2009, 01:16 PM
Uronacid QUOTE(mipadi @ May 13 2009, 02:16 PM) ... May 13 2009, 01:17 PM
mipadi Hm...that error can happen if you're using MyS... May 13 2009, 01:25 PM
Uronacid QUOTE(mipadi @ May 13 2009, 02:25 PM) Hm.... May 13 2009, 01:31 PM
mipadi Oh, wait!
CODEmysql_close(); // close... May 13 2009, 01:34 PM
Uronacid QUOTE(mipadi @ May 13 2009, 02:34 PM) Oh,... May 13 2009, 01:37 PM
Mike Topic closed & moved. May 13 2009, 03:51 PM![]() ![]() |