MySQL: Enable LOAD DATA LOCAL INFILE

后端 未结 18 1491
北海茫月
北海茫月 2020-11-22 09:30

I\'m running Mysql 5.5 on Ubuntu 12 LTS. How should I enable LOAD DATA LOCAL INFILE in my.cnf?

I\'ve tried adding local-infile in my config at various places but I\'

18条回答
  •  闹比i
    闹比i (楼主)
    2020-11-22 09:35

    Also, for other readers, if you are trying to do this in Django AND your server allows local_infile (you can check by typing SHOW VARIABLES via a mysql client) then you can add this to your settings.py file (since python MySQLdb doesn't by default read the .my.cnf file):

    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': 'mydb',
            'USER': 'myname',
            'PASSWORD': 'mypass',
            'HOST': 'myserver',
            'PORT': '3306',
            'OPTIONS' : {
                'local_infile':1,
            },
        }
    }
    

提交回复
热议问题