MYSQL: Access denied for user 'root'@'localhost' (using password: NO)
hello database gurus,
i have another one for you guys. i am getting this error: [root@bluebananas mysql]# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) i don't know what's going on. i can get in, however, after providing a password, using command: [root@bluebananas mysql]# mysql -u root -p mysql but using commands: 1) mysql (plain) 2) mysqladmin variables gave me the access error. i have a webserver running using apache and php (works fine). i'm trying to integrate and use mysql to my system. i copied a php script from a book to test my php-apache-mysql connection but its not giving me any expected output. you will notice that i placed "echo" before and after mysql_connect. it showed "connecting" on the browser, but seemed to hang because it does not show "after connecction". here's the code: ///// database_connection.php <?php $dbUser = 'test_user'; $dbPass = 'test_pass'; $dbName = 'my_test'; $dbHost = 'localhost'; echo "Connecting"; $sql = mysql_connect($dbHost, $dbUser, $dbPass) or die (mysql_error()); echo "After Connection"; mysql_select_db($dbName, $sql) or die (mysql_error()); ?> ///// database_insert.php <?php include ('database_connection.php'); for ($i = 0; $i <= 50; $i++) { if($i % 2) { $data = $i.' -Odd Result'; } else { $data = $i.' -Even Result'; } mysql_query("INSERT INTO my_table (my_value, my_date) VALUES ('$data', now())") or die (mysql_error()); echo "Inserting: $data<br />"; } echo "Done<br />"; ?> where does mysql put its errors by the way? thanks guys! jun |
Quote:
Code:
alias mysql="mysql -p" Quote:
Code:
<?php # Script 6.4 - mysql_connect.php Maybe, this will be a little more verbose, but the define statement may be a little more robust than just assigning a value? Maybe, a true guru can answer that one. I don't know the answer to the last question, so hopefully someone else will come along with another answer. Regards, Alunduil |
MYSQL: Access denied for user 'root'@'localhost' (using password: NO)
I have upgraded from Debian lenny to squeeze, and voila I got the same error on the first reboot and all the time since. After a lot of swearing and searching I tried this command :: mysql_setpermission.
That fixed it for good. You can even set up some new users and their passwords too. Regards Frik Brits |
|
All times are GMT -5. The time now is 12:21 AM. |