The data in my column , lib_question , are encrypted using AES_ENCRYPT. Now I want to search records from the table where this column is LIKE a particular entry typed by the user. I tried this but it does not work :
where lib_question like CONCAT('%',AES_ENCRYPT('contribuer', HEX('AVtr34ENMG')),'%');
AES_ENCRYPT will add padding around the input string (https://dev.mysql.com/doc/refman/5.6/en/encryption-functions.html#function_aes-encrypt), which means your comparison will never match on the encrypted strings.
Have you tried comparing the decrypted values? That should be more reliable.
select id_question from question where AES_DECRYPT(lib_question, HEX('AVtr34ENMG')) like '%contribuer%';