I am trying to connect MySQL database in Netbeans and stuck at the very first step- connecting the database. My Database is working fine on the console - tried command mysqladmin -u root -p ping
and it says mysql id is alive. I have even created database from console.
Now when i register it in Netbeans
Server Host Name:localhost
Server Port:3306
Admin user : root
Admin password :
and Admin Properties:
Path to admin tool: C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqladmin.exe
Argument :
Path to start command:C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld.exe
Argument : --console
Path to stop command:C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqladmin.exe
Argument : -u root shutdown
but i still get message:-
"MySQL Server at localhost:3306 [root] (disconnected)"
if i right click and select "start" or "connect" i get the message in taskbar -
Waiting for MYSQL Server to start...
for an infinite time.
Any help what am i doing wrong here???
解决方案
Follow these 2 steps:
STEP 1 :
Follow these steps using the Services Tab:
Right click on Database
Create new Connection
Customize the New COnnection as follows:
Connector Name: MYSQL (Connector/J Driver)
Host: localhost
Port: 3306
Database: mysql ( mysql is the default or enter your database name)
Username: enter your database username
Password: enter your database password
JDBC URL: jdbc:mysql://localhost:3306/mysql
CLick Finish button
NB: DELETE the ?zeroDateTimeBehaviour=convertToNull part in the URL.
Instead of mysql in the URL, you should see your database name)
STEP 2 :
Right click on MySQL Server at localhost:3306:[username](...)
Select Properties... from the shortcut menu
In the "MySQL Server Properties" dialog select the "Admin Properties" tab
Enter the following in the textboxes specified:
For Linux users :
Path to start command: /usr/bin/mysql
Arguments: /etc/init.d/mysql start
Path to Stop command: /usr/bin/mysql
Arguments: /etc/init.d/mysql stop
For MS Windows users :
NOTE: Optional:
In the Path/URL to admin tool field, type or browse to the location of your MySQL Administration application such as the MySQL Admin Tool, PhpMyAdmin, or other web-based administration tools.
Note: mysqladmin is the MySQL admin tool found in the bin folder of the MySQL installation directory. It is a command-line tool and not ideal for use with the IDE.
We will use MySQL Workbench in this example. Please use the path of your installation if you have MySQL workbench and the path to MySQL.
Path/URL to admin tool: C:\Program Files\MySQL\MySQL Workbench CE 5.2.47\MySQLWorkbench.exe
Arguments: (Leave blank)
Path to start command: C:\mysql\bin\mysqld (OR C:\mysql\bin\mysqld.exe)
Arguments: (Leave blank)
Path to Stop command: C:\mysql\bin\mysqladmin (OR C:\mysql\bin\mysqladmin.exe )
Arguments: -u root shutdown (Try -u root stop)
Possible exampes of MySQL bin folder locations for Windows Users:
C:\mysql\bin
C:\Program Files\MySQL\MySQL Server 5.1\bin\
Installation Folder: ~\xampp\mysql\bin