将 MySQL 服务器连接到 NetBeans

connecting MySQL server to NetBeans(将 MySQL 服务器连接到 NetBeans)
本文介绍了将 MySQL 服务器连接到 NetBeans的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Netbeans 中连接 MySQL 数据库并停留在第一步 - 连接数据库.我的数据库在控制台上运行良好 - 尝试命令 mysqladmin -u root -p ping它说 mysql id 还活着.我什至从控制台创建了数据库.现在当我在 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 :<the password which works on console> 

和管理员属性:

Path to admin tool: C:Program FilesMySQLMySQL Server 5.6inmysqladmin.exe 
Argument : <blank> 
Path to start command:C:Program FilesMySQLMySQL Server 5.6inmysqld.exe 
Argument : --console <as suggested in http://forums.netbeans.org/topic12767.html>
Path to stop command:C:Program FilesMySQLMySQL Server 5.6inmysqladmin.exe
Argument : -u root shutdown  

但我仍然收到消息:-本地主机上的 MySQL 服务器:3306 [root](已断开连接)"

but i still get message:- "MySQL Server at localhost:3306 [root] (disconnected)"

如果我右键单击并选择开始"或连接",我会在任务栏中收到消息 -正在等待 MYSQL 服务器启动...无限的时间.

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???

推荐答案

遵循以下 2 个步骤:

Follow these 2 steps:

使用服务标签执行以下步骤:

Follow these steps using the Services Tab:

  1. 右键单击数据库
  2. 创建新连接

按如下方式自定义新连接:

Customize the New COnnection as follows:

  1. 连接器名称:MYSQL(连接器/J 驱动程序)
  2. 主机:localhost
  3. 端口:3306
  4. 数据库:mysql(mysql是默认的或者输入你的数据库名)
  5. 用户名:输入您的数据库用户名
  6. 密码:输入您的数据库密码
  7. JDBC URL:jdbc:mysql://localhost:3306/mysql
  8. 点击完成按钮
  1. Connector Name: MYSQL (Connector/J Driver)
  2. Host: localhost
  3. Port: 3306
  4. Database: mysql ( mysql is the default or enter your database name)
  5. Username: enter your database username
  6. Password: enter your database password
  7. JDBC URL: jdbc:mysql://localhost:3306/mysql
  8. CLick Finish button

注意:删除 URL 中的 ?zeroDateTimeBehaviour=convertToNull 部分.您应该看到您的数据库名称,而不是 URL 中的 mysql)

NB: DELETE the ?zeroDateTimeBehaviour=convertToNull part in the URL. Instead of mysql in the URL, you should see your database name)

  1. 右键单击MySQL Server at localhost:3306:[username](...)
  2. 从快捷菜单中选择属性...

MySQL 服务器属性" 对话框中,选择管理属性" 选项卡在指定的文本框中输入以下内容:

In the "MySQL Server Properties" dialog select the "Admin Properties" tab Enter the following in the textboxes specified:

对于 Linux 用户:

  1. 启动命令的路径:/usr/bin/mysql
  2. 参数:/etc/init.d/mysql start
  3. 停止命令的路径:/usr/bin/mysql
  4. 参数:/etc/init.d/mysql stop

对于 MS Windows 用户:

注意:可选:

在管理工具的路径/URL 字段中,输入或浏览到您的 MySQL 管理应用程序的位置,例如 MySQL 管理工具、PhpMyAdmin 或其他基于网络的管理工具.

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.

注意:mysqladmin是MySQL安装目录bin文件夹下的MySQL管理工具.它是一个命令行工具,不适合与 IDE 一起使用.

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.


我们将在本例中使用 MySQL Workbench.如果你有 MySQL 工作台和 MySQL 的路径,请使用你的安装路径.


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.

  1. 管理工具的路径/URL: C:Program FilesMySQLMySQL Workbench CE 5.2.47MySQLWorkbench.exe
  2. 参数:(留空)
  3. 启动命令的路径: C:mysqlinmysqld (OR C:mysqlinmysqld.exe)
  4. 参数:(留空)
  5. 停止命令的路径: C:mysqlinmysqladmin (OR C:mysqlinmysqladmin.exe )
  6. 参数: -u root shutdown(试试-u root stop)
  1. Path/URL to admin tool: C:Program FilesMySQLMySQL Workbench CE 5.2.47MySQLWorkbench.exe
  2. Arguments: (Leave blank)
  3. Path to start command: C:mysqlinmysqld (OR C:mysqlinmysqld.exe)
  4. Arguments: (Leave blank)
  5. Path to Stop command: C:mysqlinmysqladmin (OR C:mysqlinmysqladmin.exe )
  6. Arguments: -u root shutdown (Try -u root stop)

Windows 用户的 MySQL bin 文件夹位置的可能示例:

  • C:mysqlin
  • C:Program FilesMySQLMySQL Server 5.1in
  • 安装文件夹:~xamppmysqlin

这篇关于将 MySQL 服务器连接到 NetBeans的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)