0

I have a problem with mysql command on Kali Linux OS. I'm using this command to connect to MySQL database on remote computer in local network (IP address: 172.16.64.81) but when i tried this command, it always force me to connect localhost and output the error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Screenshot of error

Clearly, i don't want to connect localhost and this is my command i used here:

mysql -u root -p -P 13306 -h 172.16.64.81

Please note that this is credential i'm using to login remote database. Username is 'root' and password is empty. I don't know why 'mysql' command enforces me to connect back to localhost? I don't use mysql database on my localhost. Flag:

  • -u | --user -- username
  • -p | --password -- password
  • -h | --host -- Remote IP or Hostname
  • -P | --port -- optional Port number
Victor Le
  • 9
  • 2
  • you need to define a user with the grant to connect. currently your user has a grant only for localhost. – Lelio Faieta Jul 12 '21 at 16:38
  • yes. the username & password you are trying is probably for local mysql server. for remote server, you can find root pass from at the time of creation of db – Hari Kishore Jul 12 '21 at 16:51
  • Yes, thank all. Please note that this is credential i'm using to login remote database. Username is 'root' and password is empty. I don't know why 'mysql' command enforces me to connect back to localhost? – Victor Le Jul 12 '21 at 16:56

0 Answers0