Question

MySQL not writing to database

I followed along with the Digitalocean LEMP stack tutorial and everything works perfectly. My app is running smoothly, but for some reason it can’t seem to write to my database. It reads and even updates the database without problems, but whenever I try to take any action that should write to the database it doesn’t work. It connects to the database, executes the query and returns the necessary data, but nothing has been written to the database.

I’ve followed the tutorial to the tee on Ubuntu 20.04. But then I also tried giving the MySQL user full privileges on the database, but still nothing. I’ve removed the user and added a new one, gave privileges, flushed privileges, and restarted MySQL too. Still nothing.

I thought I’d enable the MySQL error logging to see what errors pop up, but non of the tutorials I found worked.

Does anyone perhaps know what could be the issue here? And if not, is there a working/updated tutorial on Digitalocean that will help me to enable MySQL error logging so I can try and figure it out myself?

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

I would recommend making sure that you’ve granted all privileges to the new user that you’ve created:

GRANT ALL ON example_database.* TO 'example_user'@'%';

If this still does not help, can you share an example of the problematic code snippet that you are using the insert data into the database?

Regards, Bobby