Generating openssl certificate and fixed mysql query