Unable to launch Hive metastore with MySql empty password - mysql

My local MySql do not have password for login, so I set hive-site.xml config for:
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value/>
<description>password to use against metastore database</description>
But After launching metastore with
hive --service metastore
It always show there's password
Caused by: java.sql.SQLException: Access denied for user 'root'#'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965) ~[mysql-connector-java-5.1.45-bin.jar:5.1.45]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973) ~[mysql-connector-java-5.1.45-bin.jar:5.1.45]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909) ~[mysql-connector-java-5.1.45-bin.jar:5.1.45]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:873) ~[mysql-connector-java-5.1.45-bin.jar:5.1.45]
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1710) ~[mysql-connector-java-5.1.45-bin.jar:5.1.45]
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1226) ~[mysql-connector-java-5.1.45-bin.jar:5.1.45]
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2188) ~[mysql-connector-java-5.1.45-bin.jar:5.1.45]
at com.mysql.jdbc.ConnectionImpl.connectOneTryO
How to fix it?

Sovled by add --hiveconf when start the server.
hive --hiveconf javax.jdo.option.ConnectionPassword= --service metastore

Related

Unable to connect to mysql from sts

I have provided the credentials in application.properties to connect to Mysql but spring-boot is failing to take those credentials.
This is my application.properties file:
spring.jpa.hibernate.ddl-auto=none
spring.datasource.url=jdbc:mysql://localhost/person_example
spring.datasource.data-username=root
spring.datasource.data-password=password
the error shown in console:
java.sql.SQLException: Access denied for user ''#'localhost' (using password: NO)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[mysql-connector-java-8.0.15.jar:8.0.15]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.15.jar:8.0.15]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.15.jar:8.0.15]
See docs on common speinh properties here:
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
You need to use spring.datasource.username and spring.datasource.password

Cannot create PoolableConnectionFactory on jenkins

I am using Sonarqube with MySql. I have Jenkins in place and I would like to integrate Sonar runner with TC for differents projects mainly (Java, PHP). I have done following :
Download sonar zip (last version) in windows plateform.
StartSonar.bat
I have a MySQL in CentOS in Remote VM :
I connect to remote MySQL using Cygwin ssh:
then I create a schema, as follow :
MySQL:
CREATE DATABASE sonar CHARACTER SET UTF8;
CREATE USER 'sonar'#'*' IDENTIFIED BY 'sonar';
GRANT ALL ON sonar.* TO 'sonar'#'*';
FLUSH PRIVILEGES;
Then I disabled the VM firewall with : sudo systemctl stop firewalld
When I start my sonar with StartSonar.bat, I have the following error:
Stacktrace:
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'sonar'#'10.1.162.61' (using password: YES))
at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388) ~[commons-dbcp-1.4.jar:1.4]
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044) ~[commons-dbcp-1.4.jar:1.4]
at org.sonar.core.persistence.DefaultDatabase.checkConnection(DefaultDatabase.java:115) ~[sonar-core-5.1.2.jar:na]
... 28 common frames omitted
Caused by: java.sql.SQLException: Access denied for user 'sonar'#'10.1.162.61' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) ~[mysql-connector-java-5.1.34.jar:5.1.34]
What am I missing here, please ?
The solution is to enable sonar credentials in sonar.properties in conf folder as follow :
# User credentials.
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
#----- MySQL 5.x
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported.
sonar.jdbc.url=jdbc:mysql://10.1.163.103:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance

using mysql with hive

I am having problem in using mysql via HIVE. When I do:
hive> show tables;
FAILED: Error in metadata: java.lang.RuntimeException: Unable to instantiate org.apache.hadoop.hive.metastore.HiveMetaStoreClient
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
This is the section of the hive.log file:
2014-12-10 19:46:01,928 ERROR Datastore.Schema (Log4JLogger.java:error(125)) - Failed initialising database.
Access denied for user 'root'#'localhost' (using password: YES)
org.datanucleus.exceptions.NucleusDataStoreException: Access denied for user 'root'#'localhost' (using password: YES)
This is the section of hive-site.xml
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value></value>
</property>
but when I do the same query in MYSQL there is no problem.
The hive.log shows clearly that the issue is a failed attempt by the hive client to authenticate against the mysql database used by the hive metastore server.
You apparently do not have the correct root password for mysql. You will either need to correct the password by obtaining from the sysadmin or reset it. Following are instructions on how to reset the password:
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
I believe there might be 2 issues. One is your Hive service client or Hive server itself is not running. Second make sure the user has able to connect mysql.

Hive connectivity to MySQL: Access denied for user 'hive'#'localhost' hive

I am setting up Hive on CentOS, and I have installed hadoop, hive and MySQL on the same server. I have also setup metastore DB on mySQL and user ID - hive has access to the database.
I have the below issue - Error Message is given below. Can some one help to fix this issue?
show databases;
FAILED: Error in metadata: MetaException(message:Got exception: org.apache.hadoop.hive.metastore.api.MetaException
javax.jdo.JDODataStoreException: Access denied for user
'hive'#'localhost' (using password: YES)
NestedThrowables:
java.sql.SQLException: Access denied for user 'hive'#'localhost' (using password: YES))
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
Hive-site.xml is given below.
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://127.0.0.1/metastore?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
<description>Driver class name for a JDBC metastore</description>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>hive</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>password</value>
</property>
<property>
<name>hive.hwi.war.file</name>
<value>/usr/lib/hive/lib/hive-hwi-0.10.0-cdh4.2.0.jar</value>
<description>This is the WAR file with the jsp content for Hive Web Interface </description>
</property>
<property>
<name>datanucleus.fixedDatastore</name>
<value>true</value>
</property>
<property>
<name>datanucleus.autoCreateTables</name>
<value>true</value>
</property>
<property>
<name>hive.metastore.uris</name>
<value>thrift://127.0.0.1:9083</value>
<description>IP address </description>
</property>
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive2/warehouse</value>
<description> warehouse </description>
</property>
I am able to login to MySQL using hive and password and able to create tables in Metastore Database. Not sure where is the issue? Any suggestions?
The above error is because of insufficient privilege for 'hive'#'localhost' in mysql server. Start mysql shell as root, then execute the following grant option there
$ mysql -u root -p -hlocalhost
Enter password:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'hive'#'%' IDENTIFIED BY 'password';
mysql> FLUSH PRIVILEGES;
The error is while granting the privileges in mySQL configuration. You should give as follows:
grant all on . to 'hive'#127.0.0.1 identified by 'YourPassword'
Since you have given the hostname as 127.0.0.1 in hive-site.xml as below:
javax.jdo.option.ConnectionURL : jdbc:mysql://127.0.0.1/metastore?createDatabaseIfNotExist=true
Just ran into this issue, share my story to anyone who might meet same scenario.
If you follow most tutorials, at first, you will set javax.jdo.option.ConnectionURL's host as localhost or 127.0.0.1.
And you also guarantee the privilege to MySQL like grant all on *.* to 'user'#localhost indentified by 'password';
As time pass by, you may need to change javax.jdo.option.ConnectionURL to remote MySQL server IP. Be sure that the user may not have the privilege to access it unless you guarantee the privilege for that specific host, namely
grant all on *.* to 'user'#remote_ip_address indentified by 'password'

Hive integration with mysql

i already installed Hive with hadoop over Hbase, i changed the configuration of database driver from derby to MySQL, but i got this exception
FAILED: Error in metadata: javax.jdo.JDOFatalDataStoreException: Access denied for user 'DBAUSER'#'linux-96' (using password: YES)
NestedThrowables:
java.sql.SQLException: Access denied for user 'DBAUSER'#'linux-96' (using password: YES)
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
i already installed MySQL on localhost and configured hive-site.xml to read from this db
i don't know where is the problem, could anyone help?
This is question is mostly related to your MySQL configuration.
I bet that the problem is in your jdbc URL configuration. The error says is trying to connect to host linux-96 and you mentioned you have installed your MySQL server in your localhost.
First run MySQL server in your localhost and try to open a client session:
$ sudo service mysqld start
$ mysql -h localhost -u root -p
You should be able to login (if not search for how to reset MySQL root password)
Create your destination database in MySQL and a user and a password and check you can log in by command line before going ahead.
$ mysql -h localhost -u <user> -p<password> <database>
Then check you hive-site.xml configuration. You should have something like this:
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://localhost:3306/database?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>user</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>password</value>
</property>
Error strictly says, that you need to add necessary permissions to MySQL table.
Read more about MySQL permissions here: http://dev.mysql.com/doc/refman/5.5/en/grant.html
Here is useful tutorial: http://kb.mediatemple.net/questions/788/HOWTO%3A+GRANT+privileges+in+MySQL#dv
Your mysql password has changed. This is the only reason.
I have the same error, because my workmate changed mysql password without a word