mysql连接netbeans7.1,将MySQL服务器连接到NetBeans

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值