Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to load some xml into an AWS RDS (mySql) instance.

The xml looks like: (it's an xml dump of the ISO-3661 codes)

<?xml version="1.0" encoding="UTF-8"?>
<countries>
  <countries name="Afghanistan" alpha-2="AF" alpha-3="AFG" country-code="004" iso_3166-2="ISO 3166-2:AF" region-code="142" sub-region-code="034"/>
  <countries name="Åland Islands" alpha-2="AX" alpha-3="ALA" country-code="248" iso_3166-2="ISO 3166-2:AX"  region-code="150" sub-region-code="154"/>
  <countries name="Albania" alpha-2="AL" alpha-3="ALB" country-code="008" iso_3166-2="ISO 3166-2:AL" region-code="150" sub-region-code="039"/>
  <countries name="Algeria" alpha-2="DZ" alpha-3="DZA" country-code="012" iso_3166-2="ISO 3166-2:DZ" region-code="002" sub-region-code="015"/>

The command that I'm running is:

 LOAD XML LOCAL INFILE '/var/www/ISO-3166_SMS_Country_Codes.xml' INTO TABLE `ISO-3661-codes`(`name`,`alpha-2`,`alpha-3`,`country-code`,`region-code`,`sub-region-code`);

The error message I get is:

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

The infile that is referenced exists, I've selected a database before running the command and I have appropriate privileges on the database. The column names in the database table exactly match the xml field names.

share|improve this question
1  
Are you running a MySQL 5.0 RDS? LOAD XML is 5.5+. –  ceejayoz Aug 24 '12 at 3:20
    
RDS 5.5.20 according to the AWS console. –  RoyHB Aug 24 '12 at 6:43
    
I can't see why the question was down voted? Anyone care to educate me? –  RoyHB Aug 24 '12 at 6:44
    
Random downvotes happen all the time. I've +1'ed you back to 0. –  ceejayoz Aug 24 '12 at 13:54
add comment

1 Answer

There are two things here. One is server-side, the other is client-side.

On the server (AWS RDS), check your parameter group to ensure local_infile is set to 1. By default it is enabled in RDSland for 5.1 and 5.5.

Second, assuming you are using the mysql commandline, start it with the local-infile option:

mysql --local-infile -hhostname -uusername -p databasename

You can also set local-infile in your my.cnf, though it is tied to the machine in that case; YMMV, IANAL, FSCK, etc.

Note this 5.1 documentation says "By default, all MySQL clients and libraries in binary distributions are compiled with the --enable-local-infile option, to be compatible with MySQL 3.23.48 and before." That doesn't appear to be the case with recent distros, at least:

$ mysql --help | grep ^local-infile  # Ubuntu 12.04
local-infile                      FALSE
$ mysql --help | grep ^local-infile  # Ubuntu 12.04, fairly stock AWS AMI
local-infile                      FALSE
$ mysql --help | grep ^local-infile  # OSX 10.8
local-infile                      FALSE
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.