MySQL

MySQL is a popular open source database often used in web applications.

Choosing a driver

  • The connector/J product from MySQL.com is probably the best for most uses.

  • If you want a driver that is licensed under different terms (LGPL) then there is also the older MM driver.

    Note: this driver is no longer supported by its developers.

    You can if you wish install both drivers however it is recommended to install only one driver for each database/sub-protocol

Installing the MySQL JDBC Driver

These instructions are based on version 3.1.12 of the JDBC driver. If you are using a newer version then the name of the jar file will match the version number of the driver that you using. Subsitute this for the name below.

  1. Quit SQLEditor if it is currently running

  2. Download and unpack the driver archive using stuffit or similar

  3. Locate the file mysql-connector-java-3.1.12-bin.jar.

  4. Copy the file mysql-connector-java-3.1.12-bin.jar to the directory /Library/Java/Extensions/

  5. Start SQLEditor

  6. Show the preferences window using SQLEditorPreferences and select the database tab. Then enter the values as follows:

    Value

    MySQL Connector/J

    MM driver

    Driver Name

    MySQL

    MySQL

    classpath

    com.mysql.jdbc.Driver

    org.gjt.mm.mysql.Driver

    subprotocol

    mysql

    mysql

  7. Click the add button

Importing a database structure from MySQL

  1. Choose File→Import From Database

  2. Select the mysql database driver in the popup menu. Then enter the details of the connection into the fields.

    In this example picture we are loading the database test using a database server running on the local machine with a username of test and a password of test. All other options should be left empty. The connection string will auto-complete with the suggested database url. Unless it looks wrong you should probably use the suggested database url.

    Value

    Setting

    Hostname

    localhost

    the name of the machine that the database is running on (Use localhost if the database is on the same machine)

    Database

    test

    The name of the database to connect to

    Username

    username

    The username that you wish to connect using

    Password

    pass

    The password to use (optional)

  3. Click the import button and after a few moments the database structure will appear in new window