0

Are constraints (specifically: foreign key) errors being logged on the server side (MySQL 8.0.39)?

The question arose because there was a migration problem and the number of errors exploded on the client side, but we didn't see anything on the server side.

I tried simulating the error in Docker and didn't see anything, neither in stdr nor in the general log that was enabled:

docker run -d --name mysql-container -p 3306:3306 \
    -e MYSQL_ROOT_PASSWORD=senha123 \  
mysql:8.0 \
    --log-error-verbosity=3 \
    --general-log=1 \
    --general-log-file=/var/log/mysql/general.log
    enter code here

I saw this conversation on Stack Overflow, but it refers to older versions of MySQL: https://stackoverflow.com/questions/5579957/logging-query-errors-in-mysql

The AI ​​tools sometimes say that the errors are logged, other times they say they aren't.

New contributor
AndersonCode42 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
1
  • Based on my understanding, MySQL’s standard logs (General, Error, Slow Query) do not record foreign key constraint violations, since these are considered application-side data errors rather than server issues. It’s possible that the Audit Log plugin could capture them, but I don’t have direct experience with it to confirm. Commented Nov 29 at 8:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.