MySQL Database

MySQL Injection

Understand and prevent SQL injection attacks.

SQL injection occurs when untrusted input is concatenated into SQL. Never build queries by joining user input into a string.

SELECT * FROM users WHERE email = ?;

Use prepared statements, validate input, apply least-privilege database accounts, and avoid exposing detailed database errors.