Skip to content

Connecting_to_MySQL_4.x_and_5.x

Stephane Bouchet edited this page May 29, 2024 · 2 revisions

Connecting to MySQL 4.x and 5.x

← Back to How Do I Connect to...

MySQL 4.x and 5.x

  • Let un == user name (for example, "root")

  • Let pw == password

  • Define a driver template for MySQL 4.1 (use this for 5.x too). (Window, Preferences, Connectivity, Driver Definitions; select Database, MySQL, 4.1, click Add)

  • Then in "Available driver templates", select Database, MySQL, 4.1, MySQL JDBC Driver, and give driver a name like "My MySQL". Check "Edit New Driver Definition Immediately". Click "OK".

  • Remove faulty jar files, and add the right one (like mysql-connector-java-5.0.4-bin.jar) from known location (if you don't have one, download it from MySQL site)

  • Database name: yourDatabaseName

  • Driver class: com.mysql.jdbc.Driver

  • Connection URL: jdbc:mysql://localhost/yourDatabaseName

  • User ID: un

  • Password: leave blank, will be added later

Next, create the connection profile (Window, Show View, Data Source Explorer, right-click Databases, New)

  • Choose "Generic JDBC Connection"
  • Give the profile an appropriate name, such as "MySQL - yourDatabaseName"
  • Choose the driver template you just created from the combo box (e.g. "My MySQL")
  • Add password
  • Test connection with "Test connection" button
  • "Finish" to save the connection profile

Note that you might have to tweak these values for your case. Results in a partial tree in Data Source Explorer, and can be used with the SQL Editor.

(Migrated from https://wiki.eclipse.org/Connecting_to_MySQL_4.x_and_5.x

Clone this wiki locally