2

I am on Windows 10 desktop with a Cloudera VM running on it. From inside the coudera vm Linux OS, I can login to MySQL with:

mysql -ucloudera -pcloudera

When I try to connect to the MySQL inside Cloudera VM from my windows machine, using JDBC, I get this error: (my windows computer name is a TV with no domain name)

java.sql.SQLException: Cannot create PoolableConnectionFactory (Access denied for user 'cloudera'@'tv.lan' (using password: YES))

jdbc:mysql://quickstart.cloudera:3306/infa_mdm user = cloudera password = cloudera

How do I disable this automatic addition of domain name at the end? Or is there any other way to resolve this?

Below is Apache JMeter's JDBC connection config: enter image description here

Mate Mrše
  • 7,997
  • 10
  • 40
  • 77
sumon c
  • 739
  • 2
  • 10
  • 18
  • I avoided the problem for now, by adding a mysql user with the domain name and GRANTed all privileges as per: https://stackoverflow.com/questions/16287559/mysql-adding-user-for-remote-access/37341046 But that would not solve the problem in a real life project. – sumon c Feb 10 '19 at 02:20
  • I am using Apache JMeter's JDBC Config to setup the JDBC connection ( edited Question to include the photo of JDBC connection). there are few text boxes: URL = jdbc:mysql://quickstart.cloudera:3306/infa_mdm User = cloudera, Pass = cloudera – sumon c Feb 10 '19 at 02:23
  • AFAIK you can't, because - again AFAIK - it is determined by MySQL server, not by the client (if the client could, that would be a severe security issue). You'll need to explicitly grant to this combination (or grant to the less secure `'cloudera'@'%'`). It works in the first case because MySQL will infer that as `'cloudera'@'localhost'` or something like that. – Mark Rotteveel Feb 10 '19 at 10:04

1 Answers1

1

GRANT privilegies to 'cloudera'@'tv.lan'
Thats because of MySQL's have the host based permission. Each Username and its Hostname stored in a separate column in the mysql.users table, so if you want to be able to log in to MySQL from tv.lan computer on behalf of cloudera user, you need to give access permission to this user and this hostname -

As documentation says:

An account when first created has no privileges and a default role of NONE. To assign privileges or roles, use the GRANT statement.

Each account name uses the format described in Section 6.2.4, “Specifying Account Names”. For example:

CREATE USER 'jeffrey'@'localhost' IDENTIFIED BY 'password';

The host name part of the account name, if omitted, defaults to '%'.

Check this Data Base JMeter testing tips for additional information:
- Building a Database Test Plan
- JMeter Database Testing
- JMeter Cloud testing your DB

Vadim Yangunaev
  • 1,817
  • 1
  • 18
  • 41