首页 > 解决方案 > 如何从主机访问hadoop VM中的mysql

问题描述

我正在尝试通过 VM hadoop 连接到 mysql,但出现此错误:

# mysql -u root -p
-bash: mysql: command not found

我确认 .jar 在 Java 共享目录中:

# ls /usr/share/java/mysql-connector-java.jar
/usr/share/java/mysql-connector-java.jar

执行以下命令:

# ambari-server setup --jdbc-db=mysql --jdbc-driver=/usr/share/java/mysql-connector-java.jar
Using python  /usr/bin/python
Setup ambari-server
Copying /usr/share/java/mysql-connector-java.jar to /var/lib/ambari-server/resources
If you are updating existing jdbc driver jar for mysql with mysql-connector-java.jar. Please remove the old driver jar, from all hosts. Restarting services that need the driver, will automatically copy the new jar to the hosts.
JDBC driver was successfully initialized.
Ambari Server 'setup' completed successfully.

我怎么无法连接到 mysql ?谢谢

标签: mysqlhadoopambari

解决方案


推荐阅读