Created on 06-22-2018 07:39 PM - edited 09-16-2022 06:22 AM
I am getting the below error :
[biswas5375@sandbox-host ~]$ mysql
-bash: mysql: command not found
[biswas5375@sandbox-host ~]$ ssh -p 2222 root@localhost
root@localhost's password:
Last login: Fri Jun 22 18:13:17 2018 from 172.17.0.1
[root@sandbox-hdp ~]#
[root@sandbox-hdp ~]#
[root@sandbox-hdp ~]#
[root@sandbox-hdp ~]#
[root@sandbox-hdp ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@sandbox-hdp ~]#
Created 06-24-2018 11:47 PM
Are you attempting to log into the mysql instance or are you trying to determine if the mysql instance is running or not?
If the former, your access is being denied because you're not supplying the password to the server and so you must invoke the mysql command using the "--password" command line argument and actually supply the relevant password.
If the latter, try using the mysqladmin command instead of the mysql command. mysqladmin is a utility for performing administrative operations:
[root@sandbox-hdp ~]# mysqladmin -u root -p status
If the mysql server is actually running it will return output displaying the uptime, number of running threads, and so on. If the server is not running then it will display an error message indicating that the connection to the server failed.
Created 06-28-2018 07:19 AM
Instead of trying "[root@sandbox-hdp ~]# mysql -u root" can you also add '-p' option as well in the command line as :
# mysql -u root -p Enter password: hadoop
https://community.hortonworks.com/questions/86949/error-1045-28000-access-denied-for-user-root.html
.