Technology Software

Migrating From Access To MySQL Tutorial

    Export to CSV File

    • 1). Open your Access database. Click the "Tables" icon to open a list of tables in the database. Right-click one of the tables and select "Export." This starts the export data wizard.

    • 2). Select "Text File." This instructs Access to export the table to an external CSV file. Click "OK."

    • 3). Select "Delimited" from the file format box. When you select "Delimited," some other options appear where you set the type of text file format. Enter a comma character in the text box labeled "Choose the delimiter that separates your fields." Click "Next."

    • 4). Click "Finish" to export the data to a CSV file on your hard drive.

    Import into MySQL

    • 1). Enter the first coding statement into your MySQL console editor. The following code instructs the MySQL database to import a text file:

      load data local infile 'myAccessTable.csv' into table newTableName

      The code above imports the data from myAccessTable.csv file into a new table called "NewTableName."

    • 2). Add the delimited character to the import statement. The following MySQL code tells the console to use commas to detect that a new field is entered:

      fields terminated by ','

    • 3). Instruct the compiler to use quotes as the string indicator. The quotes character envelopes a string of characters to indicate that the characters are a part of one table field. Add the following statement to your code:

      enclosed by '"'

    • 4). Indicate the character used for a new record. Access uses the new line character in a CSV file. Add the following code to your MySQL import procedure:

      lines terminated by '\n'

    • 5). Click the "Execute" button to import the records into MySQL. It may take several minutes to import the data, depending on the size of the Access table file.



Leave a reply