将文本文本中的文本插入MySQL TEXT列

I am trying the following which is not working:

update table_name set text_column= load_file('C:\temp\texttoinset.txt') where primary_key=5;

Here text_column is of type TEXT.

This gives:

Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave. Rows matched: 1  Changed: 0  Warnings: 1

What is the right way to insert a log file contents in my SQL from PHP?

This is a possible duplicate of this question: https://serverfault.com/questions/316691/mysql-binlog-format-dilemma

Anyway, the key is Statement is unsafe because it uses a system function that may return a different value on the slave.

When the MySQL database is setup to use replication, system functions like load_file can cause issues. The file C:\temp\texttoinset.txt is likely different between the master server and the slave server (or may not even exist on one of them).

When using replication, it is best to avoid system functions (like load_file and NOW()) because the values will be different when executed on different servers. If you want to load a file into a MySQL database that uses replication, consider using PHP's file_get_contents to read the file, and then use that to insert it into the database.

As a side note, I don't know why you're trying to insert a log file into MySQL, especially as a single TEXT column. There is probably a better way to do what you are wanting to do.