I am using the Net::OpenSSH Perl module to connect to an SSH server and perform the following code:
my @cmd = 'mysql -e "SET GLOBAL general_log_file = $log"';
$ssh->system(@cmd);
Here is the correct shell command:
mysql -e "SET GLOBAL general_log_file = 'log_name'"
I am getting the following error:
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
You see that my problem is how to parse the variable correctly.
Could you please help me to correct the quoting? I have already tried all possible variants.
Thank you.
Your cmd should be a really be defined as a scalar, not a list. Since you are replacing
$logwithin the string, you should open with double quotes and wrap within single quotes for mysql: