When you execute a SQL query, you have to clean your strings or users can execute malicious SQL on your website.
I usually just have a function escape_string(blah),
the MySQL C API has it's own mysql_escape_string()
. Using it or it's equivalent would be best.
I am not sure if MySql supports parameterized queries, if so, you should make an effort to go this route. This will ensure the users input can't do anything malicious.
Otherwise some "bad" characters in addition to what you mentioned would be semicolon (;) and comments (-- and /* */).
You're better off using prepared statements with placeholders. Are you using PHP, .NET...either way, prepared statements will provide more security, but I could provide a sample.
For maximum security, performance, and correctness use prepared statements. Here's how to do this with lots of examples in different languages, including PHP:
https://stackoverflow.com/questions/1973/what-is-the-best-way-to-avoid-sql-injection-attacks
In MySQL query, when using LIKE, also make sure to escape the "_" characters as it is not escaped by mysql_real_escape_string.
For reference, check here