如何使用 Oracle SQL Developer 连接到 MySQL 数据库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/89696/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 12:02:09  来源:igfitidea点击:

How do you connect to a MySQL database using Oracle SQL Developer?

mysqloracleoracle-sqldeveloper

提问by Craig Hyatt

I have Oracle SQL Developer already installed and am able to connect to and query Oracle databases.

我已经安装了 Oracle SQL Developer,并且能够连接和查询 Oracle 数据库。

Using Help -> Check for Updates I was able to install the Oracle MySQL Browser extension but there are no connection options for MySQL databases.

使用 Help -> Check for Updates 我能够安装 Oracle MySQL Browser 扩展,但没有 MySQL 数据库的连接选项。

回答by Brian

Under Tools > Preferences > Databases there is a third party JDBC driver path that must be setup. Once the driver path is setup a separate 'MySQL' tab should appear on the New Connections dialog.

在工具 > 首选项 > 数据库下,必须设置第三方 JDBC 驱动程序路径。设置驱动程序路径后,“新建连接”对话框中应出现一个单独的“MySQL”选项卡。

Note: This is the same jdbc connector that is available as a JAR download from the MySQL website.

注意:这与可从 MySQL 网站下载 JAR 的 jdbc 连接器相同。

回答by jurevert

In fact you should do both :

事实上,你应该同时做:



  1. Add driver

  2. Add Oracle SQL developper connector

    • In Oracle SQL Developper > Help > Check for updates > Next
    • Check All > Next
    • Filter on "mysql"
    • Check All > Finish
  3. Next time you will add a connection, MySQLnew tab is available !

  1. 添加驱动程序

  2. 添加 Oracle SQL 开发人员连接器

    • 在 Oracle SQL Developper > 帮助 > 检查更新 > 下一步
    • 检查所有 > 下一步
    • 过滤“mysql”
    • 检查所有 > 完成
  3. 下次添加连接时,MySQL新选项卡可用!

回答by derekdac

Here's another extremely detailed walkthrough that also shows you the entire process, including what values to put in the connection dialogue after the JDBC driver is installed: http://rpbouman.blogspot.com/2007/01/oracle-sql-developer-11-supports-mysql.html

这是另一个非常详细的演练,它也向您展示了整个过程,包括安装 JDBC 驱动程序后在连接对话框中放置的值:http: //rpbouman.blogspot.com/2007/01/oracle-sql-developer-11 -supports-mysql.html

回答by Ale

My experience with windows client and linux/mysql server:

我使用 windows 客户端和 linux/mysql 服务器的经验:

When sqldev is used in a windows client and mysql is installed in a linux server meaning, sqldev network access to mysql.

当sqldev用在windows客户端,mysql安装在linux服务器上时,sqldev网络访问mysql。

Assuming mysql is already up and running and the databases to be accessed are up and functional:

假设 mysql 已经启动并运行,并且要访问的数据库已启动并正常运行:

? Ensure the version of sqldev (32 or 64). If 64 and to avoid dealing with path access copy a valid 64 version of msvcr100.dll into directory ~\sqldeveloper\jdev\bin.

? 确保 sqldev 的版本(32 或 64)。如果是 64 位并避免处理路径访问,请将有效的 64 位版本的 msvcr100.dll 复制到目录 ~\sqldeveloper\jdev\bin 中。

a. Open the file msvcr100.dll in notepad and search for first occurrence of “PE “

一种。在记事本中打开文件 msvcr100.dll 并搜索第一次出现的“PE”

 i. “PE  d” it is 64.

ii. “PE  L” it is 32.

b. Note: if sqldev is 64 and msvcr100.dll is 32, the application gets stuck at startup.

湾 注意:如果 sqldev 是 64 并且 msvcr100.dll 是 32,应用程序会在启动时卡住。

? For sqldev to work with mysql there is need of the JDBC jar driver. Download it from mysql site.

? 要使 sqldev 与 mysql 一起工作,需要 JDBC jar 驱动程序。从 mysql 站点下载它。

a. Driver name = mysql-connector-java-x.x.xx

一种。驱动程序名称 = mysql-connector-java-xxxx

b. Copy it into someplace related to your sqldeveloper directory.

湾 将其复制到与 sqldeveloper 目录相关的某个位置。

c. Set it up in menu sqldev Tools/Preferences/Database/Third Party JDBC Driver (add entry)

C。在菜单 sqldev Tools/Preferences/Database/Third Party JDBC Driver 中设置(添加条目)

? In Linux/mysql server change file /etc/mysql/mysql.conf.d/mysqld.cnf look for

? 在 Linux/mysql 服务器更改文件 /etc/mysql/mysql.conf.d/mysqld.cnf 中查找

bind-address = 127.0.0.1 (this linux localhost)

绑定地址 = 127.0.0.1(这个 linux 本地主机)

and change to

并更改为

bind-address = xxx.xxx.xxx.xxx (this linux server real IP or machine name if DNS is up)

bind-address = xxx.xxx.xxx.xxx(这个linux服务器的真实IP或机器名,如果DNS是up的话)

? Enter to linux mysql and grant needed access for example

? 例如,进入 linux mysql 并授予所需的访问权限

# mysql –u root -p

# mysql –u root -p

GRANT ALL ON .to root@'yourWindowsClientComputerName' IDENTIFIED BY 'mysqlPasswd';

全力以赴到 root@'yourWindowsClientComputerName' IDENTIFIED BY 'mysqlPasswd';

flush privileges;

刷新权限;

restart mysql - sudo /etc/init.d/mysql restart

重启 mysql - sudo /etc/init.d/mysql restart

? Start sqldev and create a new connection

? 启动 sqldev 并创建一个新连接

a. user = root

一种。用户 = 根

b. pass = (your mysql pass)

湾 pass =(你的mysql通行证)

c. Choose MySql tab

C。选择 MySql 选项卡

 i.   Hostname = the linux IP hostname

 ii.  Port     = 3306 (default for mysql)

 iii. Choose Database = (from pull down the mysql database you want to use)

 iv.  save and connect

That is all I had to do in my case.

这就是我在我的情况下必须做的。

Thank you,

谢谢,

Ale

麦芽酒

回答by Alvin Bunk

Although @BrianHart 's answer is correct, if you are connecting from a remote host, you'll also need to allow remote hosts to connect to the MySQL/MariaDB database.

尽管@BrianHart 的回答是正确的,但如果您从远程主机连接,您还需要允许远程主机连接到 MySQL/MariaDB 数据库。

My article describes the full instructions to connect to a MySQL/MariaDB database in Oracle SQL Developer:

我的文章描述了在 Oracle SQL Developer 中连接到 MySQL/MariaDB 数据库的完整说明:

https://alvinbunk.wordpress.com/2017/06/29/using-oracle-sql-developer-to-connect-to-mysqlmariadb-databases/

https://alvinbunk.wordpress.com/2017/06/29/using-oracle-sql-developer-to-connect-to-mysqlmariadb-databases/

回答by codingknob

You may find the following relevant as well:

您可能还会发现以下相关内容:

Oracle SQL Developer connection to Microsoft SQL Server

Oracle SQL Developer 与 Microsoft SQL Server 的连接

In my case I had to place the ntlmauth.dllin the sql-developer application directory itself (i.e. sql-developer\jdk\jre\bin). Why this location over the system jre/bin I have no idea. But it worked.

就我而言,我必须将 放在ntlmauth.dllsql-developer 应用程序目录本身(即 sql-developer\jdk\jre\bin)中。为什么这个位置在系统 jre/bin 我不知道。但它奏效了。