ERROR 1148 (42000): The used command is not allowed with this MySQL version

Mysql database reported an error when loading file contents into the table:

mysql> LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet
       LINES TERMINATED BY '\r\n';

ERROR 1148: The used command is not allowed with this MySQL version
. If LOAD DATA LOCAL is disabled, either in the server or the client, a client that attempts to issue such a statement receives the following error message:
ERROR 1148: The used command is not allowed with this MySQL version
. For security reasons, The default is not allowed to load data remotely from client host.
Solution:
in two steps:

SET GLOBAL local_infile=1;

When connecting to the database

mysql -u Name -p --local-infile=1;

When using

  conn = pymysql.connect(host="localhost",
                           user="root",
                           password="111",
                           db="work2forecast",
                           charset="utf8mb4",
                           local_infile=1)

Read More: