SQL Workbench/J is a Java GUI admin client for SQL databases including MySQL. It allows easy point and click dicovery and investigation of any MySQL database.
SQL Workbench/J installation on Linux and Microsoft Windows platforms.
- Install Java: SQL Workbench/J is a Java program and thus requires installation of the Java runtime and virtual machine. Java 1.6 is required.
download Java - Download SQL Workbench/J: download
- Download the MySQL JDBC driver: download
Java JDBC library to connect to the MySQL database.
Linux:
- Install Java. See the YoLinux.com Java installation and configuration Tutorial
Also set Java CLASSPATH environment variable (as per the instructions) - Unzip or untar (tar -d file.tar.gz) each download.
- unzip Workbench-Build110.zip
- Set Java CLASSPATH environment variable to include the JDBC driver.
- Start: ./sqlworkbench.sh
Microsoft Windows:
- Unzip each download.
- Set Java CLASSPATH environment variable:
Select "Environment Variables"Edit the CLASSPATH
C:\Program Files\Java\jre1.6.0_20\lib\rt.jar; C:\Program Files\Java\jdk1.6.0_20\lib\tools.jar;.\ - Start SQL Workbench/J:
Double-click "SQLWorkbench.exe" (or if your system is configured properly, "sqlworkbench.jar")
One must configure SQL Workbench/J to attach to the MySQL database.
- Configure SQL Workbench/J to use the Java JDBC MySQL database drivers:
Select "File + Manage Drives ..."
Be sure to change the default jdbc:mysql://hostname:port/name_of_database to your actual database configuration where the "hostname" is the network node name, its' IP address or "localhost" if the database is running locally.
The port is probably the MySQL default "3306".
Select Library by choosing the Library file and specifying the Java Classname. - Configure the database connection:
Select "File + Connect Window"
Here the URL must be edited to reflect the hostname, port and database name of the MySQL database server.
The MySQL database can be configured for remote client access by both granting remote access to the database user (all hosts "%") explicity and the MySQL "bind-address" configuration in /etc/my.cnf.
For more see the YoLinux.com Linux and MySQL Tutorial.
View Database Schema and Contents:
- Select from the tool bar: Tools + Show Database Explorer
- Select database from pull-down menu
- Click a table "NAME" to view schema in next panel
- Left click on table "NAME" and select "Pull SELECT into..." + New Tab
This generates the SQL query to view table. - Select top left arrow icon
Results panel will fill with query results
Insert / Delete a record in a table:
- Adding a record to the database, perform the above to view current table contents.
- In the results window, right click on the results table and select "Insert Row"
This will generate a row which you can edit. - Edit fields to add data.
- Right click on record to insert and select "Save changes to database".
This will have added the new record. - To delete a record, right click on record and select "Delete row".
You must follow up with Right click on table and select "Save changes to database".
Only then is the record deleted.
(this option will be dimmed and unavailable if there are no changes to "save".)