Below is my sample code:
KEY_FILE=/tmp/key.txt KEY=$(openssl rand 16) echo $KEY > $KEY_FILE ID=2345 source .mysqlCredentials.txt MySqlCommand="mysql -h $IP -u $UserName -p$Password $DBName -e" $MySqlCommand "INSERT INTO some_table ( ID , ssl_key ) VALUES (\"$ID\", \"$KEY\") ;"
the error I get is :
+ mysql -h X.X.X.X -u root -ppassword database -e 'INSERT INTO some_table ( ID , ssl_key ) VALUES ("2345", "ïëC;+¹"ë'\''J£èMÑ") ;' 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 'ë'J£èMÑ")' at line 1
Here in the generated key, I'm getting single quotes, backticks, double quotes, and spaces ... etc...
how can I overcome this error?