-bash:mysql:command not found

sandbox

#1

Hi,
What is the difference login in sandbox using ssh root@172.16.248.130 and ssh root@172.16.248.130 -p 12222
hostname also differs… Please assist.

Login through ssh root@172.16.248.130, I got error -bash:mysql:command not found
[root@sandbox-host ~]# hostname -f
sandbox-host.hortonworks.com

ssh root@172.16.248.130 -p 12222, mysql works
[root@sandbox-hdf ~]# hostname -f
sandbox-hdf.hortonworks.com

Sheiks-MacBook-Pro:~ sheik$ ssh root@172.16.248.130
root@172.16.248.130’s password:
Last login: Sat Dec 9 10:23:16 2017
[root@sandbox-host ~]# hostname -f
sandbox-host.hortonworks.com
[root@sandbox-host ~]# mysql -u root -p
-bash: mysql: command not found
[root@sandbox-host ~]# exit
logout
Connection to 172.16.248.130 closed.
Sheiks-MacBook-Pro:~ sheik$ ssh root@172.16.248.130 -p 1222
ssh: connect to host 172.16.248.130 port 1222: Connection refused
Sheiks-MacBook-Pro:~ sheik$ ssh root@172.16.248.130 -p 12222
root@172.16.248.130’s password:
Last login: Sat Dec 9 10:14:54 2017 from 172.16.248.1
[root@sandbox-hdf ~]# mysql
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO)
[root@sandbox-hdf ~]# hostname -f
sandbox-hdf.hortonworks.com
[root@sandbox-hdf ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.6.36 MySQL Community Server (GPL)

Copyright © 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>


#2

login as: root
root@127.0.0.1’s password:
Last login: Fri Jan 19 06:37:38 2018 from 10.0.2.2
[root@sandbox-hdp ~]# mysql -u root
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: N O)
[root@sandbox-hdp ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: Y ES)
[root@sandbox-hdp ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 107
Server version: 5.6.38 MySQL Community Server (GPL)

Copyright © 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

=============================================================

when I give only mysql -u root
I’m getting error message
But when I give mysql -u root -p
and give my root pwd which I changed , again getting error
Then when I give the root pwd with the defauld pwd hadoop - it’s working.

So, should I give the defauld pwd hadoop everytime ?