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:
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) .


Anonymous said...

I dont undertand. Where is mysqladmin file?

Anonymous said...

I want to know where is mysqladmin file...?

Anonymous said...

mysqladmin is inside the bin folder of MySQL/MYSQL server x.x

Anonymous said...

Search in MySQL/MYSQL server x.x/bin folder!!!

MuthuAnanth said...

I am trying to connect MySQL5.1 in Netbeans7.0.1 RC1 build in Windows 7.

But there connection refused error has been occured.

In Services --> Database --> RegisterMySQLServer
i have given this details.

Basic Prop
HostName : localhost
port : 3306
uname : root
pwd : root

admin prop
Path/url admin tool : C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe

arg :

Path to start cmd : C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld.exe

arg :

path to stop cmd : C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqladmin.exe

arg : -u root -proot stop

But connection refused error is coming. I checked jar file placed in correct place. And using mysql-connector-java-5.1.13-bin.jar.

Anybody knows solution, kindly help me

M.Muthu Ananth
Haiahtum Software

Anonymous said...

Path/url admin tool :C:\Program Files (x86)\MySQL\MySQL Tools for 5.0\MySQLAdministrator.exe

Path to start cmd :C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\mysqld.exe

path to stop cmd:C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\mysql.exe

Unknown said...

Great and Useful Article.

Online Java Training

Java Online Training India

Java Online Course

Java EE course

Java EE training

Best Recommended books for Spring framework

Java Interview Questions

Java Course in Chennai

Java Online Training India

Unknown said...

I enjoyed on reading your blog post. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. Please visit my website, Friv 4000 Games is where all the free friv games.
Friv 4000

eMexoT said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

Dot net training in electronic city

chandana said...

Thank you for sharing the amazing information.
aws course in Marathahalli

aws training center in Marathahalli

cloud computing courses in Marathahalli

amazon web services training institutes in Marathahalli

best cloud computing institute in Marathahalli

cloud computing training in Marathahalli

aws training in Marathahalli

aws certification in Marathahalli

best aws training in Marathahalli

aws certification training in Marathahalli

Keerthi55 said...

P0wer bi onlinetraining
P0wer bi training