MYSQL: Access denied for user 'root'@'localhost' (using password: NO)
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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".
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.
My guess, as I'm no guru yet, but did have the same problems you are having, is that the vanillya mysql command assumes the current user with no password. Now, this is fine if you don't care about security. My solution to this was to simply add to my ~/.bashrc file:
Code:
alias mysql="mysql -p"
Then the mysql command will use the current user, and prompt for a password.
Quote:
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".
$sql = mysql_connect($dbHost, $dbUser, $dbPass)
or die (mysql_error());
echo "After Connection";
mysql_select_db($dbName, $sql) or die (mysql_error());
?>
This is my connection script for your reference:
Code:
<?php # Script 6.4 - mysql_connect.php
define('DB_USER', '<username>');
define('DB_PASSWORD', '<password>');
define('DB_HOST', 'localhost');
define('DB_NAME', '<databasename>');
$dbc = @mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die('Could not connect to MySQL: ' . mysql_error());
mysql_select_db(DB_NAME);
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.