Database Reference
In-Depth Information
phpMyAdmin is able to detect which compression method (if any) has been applied
to the file. Depending on the phpMyAdmin version, and the extensions that are
available in the PHP component of the web server, there is variation in the formats
that the program can decompress.
However, to import successfully, phpMyAdmin must be informed of the character
set of the file to be imported. The default value is utf8 . However, if we know that the
import file was created with another character set, we should specify it here.
An SQL compatibility mode selector is available at import time. This mode should
be adjusted to match the actual data that we are about to import, according to the
type of the server where the data was previously exported.
To start the import, we click Go . The import procedure continues and we receive a
message: Import has been successfully finished, 2 queries executed . We can browse
our newly-created tables to confirm the success of the import operation.
The file could be imported for testing in a different database or even in a
MySQL server.
Importing CSV files
In this section, we will examine how to import CSV files. There are two possible
methods— CSV and CSV using LOAD DATA . The first method is implemented
internally by phpMyAdmin and is the recommended one for its simplicity. With
the second method, phpMyAdmin receives the file to be loaded, and passes it to
MySQL. In theory, this method should be faster. However, it has more requirements
due to MySQL itself (see the Requirements sub-section of the CSV using LOAD
DATA section).
Differences between SQL and CSV formats
There are some differences between these two formats. The CSV file format contains
data only, so we must already have an existing table in place. This table does not
need to have the same structure as the original table (from which the data comes);
the Column names dialog enables us to choose which columns are affected in the
target table.
Because the table must exist prior to the import, the CSV import dialog is available
only from the Import subpage in the Table view, and not in the Database view.
 
Search WWH ::




Custom Search