Linux Ubuntu 中的 MySQL JDBC jar 文件在哪里?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18128966/
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-07 00:30:35  来源:igfitidea点击:

Where is the MySQL JDBC jar file in Ubuntu?

mysqllinuxubuntu

提问by ihsan kocak

I have installed MySQL 5.5.32 via apt-get installinto Ubuntu 13.04.I want to use it in a Java project.For this i must have MySql connector jar.I can not find it.I tried locate *mysql*.jarbut it did not find anything.I looked into /etc/mysqlbut there is no jar in it.I don't want to download it from internetbecause i believe that it somehow exists in an MySQL folder.Does anybody have any idea where the connector jar went into Ubuntu 13.04?

我已经通过apt-get install到 Ubuntu 13.04安装了 MySQL 5.5.32。我想在 Java 项目中使用它。为此,我必须有 MySql 连接器 jar。我找不到locate *mysql*.jar它。我试过,但没有找到任何东西。我调查了/etc/mysql但里面没有罐子。我不想从互联网上下载它,因为我相信它以某种方式存在于 MySQL 文件夹中。有人知道连接器 jar 在哪里进入 Ubuntu 13.04 吗?

采纳答案by Jeremy Smyth

If you're using a version of Ubuntu prior to 19.04, you'll need to install libmysql-java, the MySQL JDBC driver, because the connector is not in the Ubuntu-packaged MySQL package that you've already installed. Versions after that do not publish that package.

如果您使用的是 19.04 之前的 Ubuntu 版本,则需要安装MySQL JDBC 驱动程序libmysql-java,因为该连接器不在您已经安装的 Ubuntu 打包的 MySQL 包中。之后的版本不发布该包。

Once it's installed, you'll have the file /usr/share/java/mysql.jar, which is an indirect symlink to the actual jar file.

安装后,您将拥有该文件/usr/share/java/mysql.jar,它是实际 jar 文件的间接符号链接。

Alternatively, install the mysql-apt-configpackage, update, and you'll be able to install all currently supported MySQL software with apt.

或者,安装mysql-apt-config包,更新,您将能够安装所有当前支持的 MySQL 软件apt

回答by wangzhengyi

First, apt-get install libmysql-java

第一的, apt-get install libmysql-java

Then mysql.jaris located in /usr/share/java/mysql.jar.

然后mysql.jar位于/usr/share/java/mysql.jar.

Third, in Eclipse, do this as: Project -> Properties -> Java Build Path -> Libraries -> Add External JARs -> select /usr/share/java/mysql.jar

第三,在 Eclipse 中,这样做:项目 -> 属性 -> Java 构建路径 -> 库 -> 添加外部 JAR -> 选择 /usr/share/java/mysql.jar

回答by maxikoe

In ubuntu 19.10 the following works:

在 ubuntu 19.10 中,以下工作:

apt-get install libmariadb-java