user2839288
user2839288

Reputation: 627

Enable local-infile in Mysql on Docker

I have a docker container running mysql (current) which I started with

docker run --name=mysql1 -d mysql/mysql-server

I need to import some data but the default image doesn't enable local-infile.

I don't want to break the currently running db or take it down for long.

What are my options? Is it possible to apply the --local-infile switch to an already-running container?

Thanks

Upvotes: 6

Views: 4395

Answers (1)

danblack
danblack

Reputation: 14666

local_infile is a global dynamic variable. To change at runtime execute the SQL:

SET GLOBAL local_infile=1

The client side that connects need local_infile set on the connection. If using the mysql client there is a --local-infile=1 option there, other wise look in the connection options if using a language/other script.

If you wanted to permanently enable this, the local-infile=1 option should be in the a my.cnf file in the server under a server group like [mysqld].

Upvotes: 8

Related Questions