Mysql – import text file getting command is not allowed with this MySQL version

importMySQLmysql-5.5

here is my table

CREATE TABLE cities (
    country       CHAR(2),
    city_ascii    VARCHAR(100),
    city          VARCHAR(255),
    region        CHAR(2),
    population    INT UNSIGNED,
    latitude      DECIMAL(10, 6),
    longitude     DECIMAL(10, 6),
    INDEX idx_lat_long (latitude, longitude),
    INDEX idx_country (country),
    INDEX idx_region (region)
);

I'm trying to import a text file to my database following tutorial here.

LOAD DATA LOCAL INFILE 'worldcitiespop.txt' INTO TABLE cities
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(country, city_ascii, city, region, population, latitude, longitude);

but I'm getting the following error message.

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

Any ideas?

Thank you

Best Answer

From the MySQL Documentation on Security Issues with LOAD DATA LOCAL

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

How ? The server option local_infile must be disabled. Check your my.cnf for load_infile. If you are using a web hosting service, they may or may not allow it. For example, you cannot do that with Amazon RDS for MySQL. You might be able to get away with using MySQL in Amazon EC2. Check with your administrators in that respect.