So now, can someone walk me through reconfiguring LOAD DATA LOCAL INFILE so I can import a .txt file into a mysql table?" The links on the tutorial got me all messed up.
I may not completly understand your question, but I do import a table from a text file (I suppose you mean by a .txt file a file wich contains a ‘flat’ ASCII file).
I have the following ksh script (bash will accept this also becuase it containt no specificly ksh things imho):
#!/bin/ksh
mysql -p <<EOF
DROP DATABASE spoorwegen;
CREATE DATABASE spoorwegen;
USE spoorwegen
CREATE TABLE boek (
id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT,
auteur VARCHAR(100) NOT NULL,
titel VARCHAR(100) NOT NULL,
otitel VARCHAR(100) NOT NULL,
uitg VARCHAR(60) NOT NULL,
plaats VARCHAR(30) NOT NULL,
jaar VARCHAR(4) NOT NULL,
isbn VARCHAR(13) NOT NULL,
onderw VARCHAR(100) NOT NULL,
land VARCHAR(100) NOT NULL,
PRIMARY KEY (id)
)
DATA DIRECTORY = ‘/home/databases/spoorwegen’
INDEX DIRECTORY = ‘/home/databases/spoorwegen’;
LOAD DATA INFILE ‘/home/databases/spoorwegen/spoorwegen.inport’ INTO TABLE boek;
EOF
And the file /home/databases/spoorwegen/spoorwegen.inport has the contents:
Op de Rails 29e jaargang 1961 Maandblad van de NVBS NVBS 1961
Op de Rails 30e jaargang 1962 Maandblad van de NVBS NVBS 1962
Op de Rails 31e jaargang 1963 Maandblad van de NVBS NVBS 1963
.................
which fields seperated by tabs.
Calling the script asks you to enter the password of the MySQL root user (not the system root). The DROP DATABASE must be removed when the database does not exist else the script stops there with an error.
I did not look into the meaning of the second LOCAL in your statement, but this is how mine works.