Configure MySql in NetBeans

NetBeans 6.1 has an interface to manage MySql, including start and stop MySql database server, connect/disconnect from databases, launch external MySql admin tool, execute queries, etc. Here are steps to configure MySql management inside NetBeans:

1. Create a wrapper script for mysqld_safe. The reason is that mysqld start script assumes the user is running the script from mysql base directory. An attempt to start mysqld from mysql/bin directory results in the following error:
/home/me/mysql/bin > ./mysqld_safe
./mysqld_safe: 199: my_print_defaults: not found
./mysqld_safe: 204: my_print_defaults: not found
The file /usr/local/mysql/bin/mysqld doesn't exist or is not executable
Please do a cd to the mysql installation directory and restart
this script from there as follows:
./bin/mysqld_safe.
See http://dev.mysql.com/doc/mysql/en/mysqld_safe.html for more information
So I created script /home/me/mysql/bin/mymysqld_safe, which can be called by NetBeans:
#! /bin/sh
cd /home/me/mysql/
./bin/mysqld_safe &
I had also tried changing mysqld_safe script to replace the hardcoded ./bin/ with `dirname $0`, but it caused other errors. So I figured the best option is to use a wrapper without touching mysql files.

2. Go to NetBeans Window | Services tab, and right-click DataBases node. Choose Properties.
Basic properties:
Server host name: localhost
Server port number: 3306
Administrator user name: root
Administrator password:

Admin properties:
Path/URL to admin tool: /usr/bin/mysql-admin
Path to start command: /home/me/mysql/bin/mymysqld_safe
Path to stop command: /home/me/mysql/bin/mysqladmin
Arguments to stop command: -u root shutdown

How to install MySql admin tool and Query Browser is posted in the previous post Install MySql GUI tools (MySql Administrator and Query Browser) .

Followers

Pageviews Last 7 Days