From:       To:      

DBF to MySQL Tutorial

[DBF to MySQL Converter]  [FAQ]  [Download]  [Buy]

On this page user can find step-by-step instructions on how to use DBF to MySQL conversion tool.

1. Select the conversion scenario

On this screen user has to select the conversion scenario. DBF to MySQL database migration tool provides two options to convert .dbf files into MySQL data source:

  • Move to MySQL server directly - use this approach to export the contents of the source database into a database on the target MySQL server. MySQL server must be launched and also user must have necessary privileges to write into a database on the target server. See Connect to MySQL Server section for related information.
  • Store into dump file - use this approach to perform deferred conversion and get more control over the process. Following this way, the program stores the contents of the source database into a local dump file instead of moving it to MySQL server directly. The resulting file contains MySQL statements to create all tables and to fill them with the data. See Import MySQL dump files article for related information.
    
2a. Connect to MySQL Server

If user selected "Move to MySQL server directly" option on the first page, they will see this screen where you should enter the necessary settings to establish connection with MySQL server. DBF to MySQL database conversion tool is able to connect to the target server using either local or remote mode. Local mode is being used to connect MySQL server launched on the same machine where DBF to MySQL converter is running. Remote mode allows to connect to the server launched on another computer.

By default, the program uses local connection mode. It is indicated by radio button "Local" selected. To establish remote connection user should select "Remote" radio button. For remote MySQL servers user should also enter host and TCP/IP port to connect through. Host could be either network name or IP address. TCP/IP port value is necessary only if it differs from the default MySQL port number 3306. Otherwise user may leave this field as is.

Finally, user should enter username and password. These fields can be empty for anonymous connection.

    
User must have the sufficient privileges to create new database on MySQL server. Otherwise they will be able only to import FoxPro data into an existing MySQL database. See Virtual Server User Notes for related information.

NOTE: MySQL 4.1.0 uses the authentication protocol based on a password hashing algorithm that is incompatible with that used by DBF to MySQL conversion tool. See DBF to MySQL FAQ page to learn how to resolve this problem.

2b. MySQL dump file settings

On this wizard screen user has to specify how the resulting dump file is generated. There are following settings available:

MySQL version - this parameter determines the syntax of MySQL statements being used in output dump file. 'Old' versions of MySQL (before 3.23.6) put more restrictions on database objects names. Note that 'new' syntax is not accepted by 'old' versions of MySQL. Use 'old' syntax whenever you are not sure about the version of MySQL server.

  • Line breaks - this parameter specifies how to separate text lines in the dump file. If the destination MySQL server is running on MS Windows platform, user should select 'MS Windows style' option. Otherwise select 'Unix style'.
  • Add lock for write around 'INSERT' statements - it makes importing the contents of the dump file into a database much faster. To use this feature in MySQL 4.0 and higher user needs global LOCK TABLES privilege and SELECT privilege on the involved tables. In MySQL 3.23 and earlier user needs to have SELECT, INSERT, DELETE and UPDATE privileges for the tables.
    
  • Insert 'CREATE DATABASE' statement - select this option to put 'CREATE DATABASE' statement in the resulting dump file. This setting doesn't take effect without the option below activated.
  • Insert 'CREATE TABLE' statements - select this option to put 'CREATE TABLE' statements in the resulting dump file. User should always select it in order to obtain a valid dump file. The only exception is appending the data to existing tables.
  • Insert comments - select this option to add brief comments. It makes the resulting dump file more readable. See Import MySQL dump files article to learn how to move dump file contents to MySQL server.
4. Select Databases

On this wizard screen user should enter path to the folder with FoxPro (.dbf) files to convert, MySQL database name or path to a dump file (depending on which conversion scenario has been chosen). Also, user can customize the following conversion settings:

  • Convert table definitions only - select this checkbox to convert only definitions of the original .dbf tables (no data will be converted)
  • Convert logical values 'as is' - select this checkbox to preserve the original format of boolean columns (true='T', false='F'). By default, all logical values are mapped into MySQL TINYINT(1) according to ANSI standard (true=1, false=0)
  • Don't convert deleted records - tells the program to skip all DBF records marked as deleted

By default FoxPro files contain information about encoding. Select particular encoding from "Use Encoding" combo box to override that default value.

    
5. Select Tables

On this wizard screen user can manage the list of FoxPro files to convert. In the left part of the window there is "Available tables" list box. It contains all available .dbf files from the specified folder except those are selected already. On the right there is "Selected tables" list box.

To add new .dbf files for converting into MySQL format user should select it in "Available tables" list box and click "Add" button (or double-click the selected item). Also, user can use "Add all" button to insert all available tables.

To remove an item from "Selected tables" list user should select it and click "Remove" button. User can use "Remove all" button to remove all items from "Selected tables" list box.