These statements are the fastest way for importing text in MySQL.
They cause MySQL to start a read operation from a file located on the MySQL server
(LOAD DATA INFILE) or from another place (LOAD DATA LOCAL INFILE), which in this
context, is always the web server's file system. If the MySQL server is located on
a computer other than the web server, we won't be able to use the LOAD DATA
INFILE mechanism.
Requirements
Relying on the MySQL server has some consequences. Using LOAD DATA INFILE
requires that the logged-in user possess a global FILE privilege. Also, the file itself
must be readable by the MySQL server's process.
Chapter 19 explains phpMyAdmin's interface to privileges management
for system administrators.
Using the LOCAL modifier in LOAD DATA LOCAL INFILE must be allowed by the
MySQL server and MySQL's client library used by PHP.
Both the LOAD methods are available from the phpMyAdmin LOAD interface,
which tries to choose the best possible default option.
Using the LOAD DATA Interface
We select Import from the author table menu. Choosing CSV using LOAD DATA
brings up the following dialog:
Chapter 8
[ 147 ]
The available options have already been covered in the CSV section.
In the familiar Location of the text file question, we choose our author.csv file.
Finally, we can choose the LOAD method, as discussed earlier, by selecting the
Use LOCAL keyword option.
Pages:
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153