0

I am able to SSH into amazon instance using SSH Sampler plugin after SSH'ing into instance I want to run Mysql queries to edit database entries.

I'm able to run commands like cd, ls after SSH'ing but unable to run Mysql queries.

Mysql queries work fine on running it on terminal.

Here is the snapshot of SSH Sampler plugin:

enter image description here

Masud Jahan
  • 3,418
  • 2
  • 22
  • 35
john lenin
  • 15
  • 4
  • There are better alternative solutions to run mysql queries in amazon instance. Can you please share requirements so I can suggest a solution that does not involve ssh sampler but still do the job! – TestingWithArif Jun 28 '16 at 09:40
  • You appear to want a terminal style virtual user. Have you considered leveraging any number of SSH libraries for Java? See thread -> http://stackoverflow.com/questions/995944/ssh-library-for-java – James Pulley Jun 28 '16 at 12:12
  • Yes, i was looking for terminal style virtual user where i can ssh into instance and run some api's as well as edit database entries. – john lenin Jun 28 '16 at 13:03

1 Answers1

0

Option 1: use mysql execute like:

mysql -u root -pROOT_PASSWORD -e "YOUR_QUERY_HERE"

Example:

mysql -u root -psecret -e "use mysql; select name, url from help_topic limit 5;"

MySQL Command Execution Demo

Option 2: use JDBC Request Sampler.

Given you have:

You should be able to run arbitrary queries using JDBC Request Sampler, if you need to load test MySQL instance - it will be the best way to proceed.

See The Real Secret to Building a Database Test Plan With JMeter article for detailed instructions.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133