using mysql with hive - mysql

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.

Related

Play scala - oauth2 provider mysql issue

AIM:
I am trying to implement the oauth2 in my application using Play framework 2.3, scala language and MySQL.
WHAT I DID:
I tried to use the scala-oauth2-provider. The given sample is working fine with PostgreSQL. But I want to implement this with MySQL.
WHAT I TRIED:
I have added the below dependencies in the build.sbt
"mysql" % "mysql-connector-java" % "5.1.18",
jdbc
and I removed the below dependency in the given sample.
"org.postgresql" % "postgresql" % "9.3-1100-jdbc41"
Changed the DB configuration in the application.conf
#db.default.url="jdbc:mysql://localhost/oauth"
db.default.url="jdbc:mysql://localhost:3306/oauth"
db.default.driver="com.mysql.jdbc.Driver"
db.default.user="root"
db.default.pass="root"
db.default.host="localhost"
ISSUE:
I am facing the below issue.
[error] - c.j.b.h.AbstractConnectionHook - 14:16:25.117 - Caller+0 at com.jolbox.bonecp.hooks.AbstractConnectionHook.onAcquireFail(AbstractConnectionHook.java:77)
- Failed to obtain initial connection Sleeping for 0ms and trying again. Attempts left: 0. Exception: null.Message:Access denied for user 'root'#'localhost' (using password: YES)
[error] - application - 14:16:25.131 - Caller+0 at play.api.LoggerLike$class.error(Logger.scala:141)
-
! #6nmjm0p14 - Internal server error, for (GET) [/] ->
play.api.Configuration$$anon$1: Configuration error[Cannot connect to database [default]]
at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:94) ~[play_2.11-2.3.4.jar:2.3.4]
at play.api.Configuration.reportError(Configuration.scala:743) ~[play_2.11-2.3.4.jar:2.3.4]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:247) ~[play-jdbc_2.11-2.3.4.jar:2.3.4]
at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:238) ~[play-jdbc_2.11-2.3.4.jar:2.3.4]
at scala.collection.immutable.List.map(List.scala:273) ~[scala-library-2.11.6.jar:na]
Caused by: java.sql.SQLException: Access denied for user 'root'#'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073) ~[mysql-connector-java-5.1.18.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609) ~[mysql-connector-java-5.1.18.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541) ~[mysql-connector-java-5.1.18.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:943) ~[mysql-connector-java-5.1.18.jar:na]
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4113) ~[mysql-connector-java-5.1.18.jar:na]
I have given the correct mysql credential only and also I have the database named oauth. Even though it throws "Access denied for user 'root'#'localhost' (using password: YES)" error.
Can anyone help me to fix this?
Please take the following actions:
In mysql, under root user:
CREATE USER 'test1'#'localhost' IDENTIFIED BY 'mypass';
CREATE DATABASE oauth;
GRANT ALL ON oauth.* TO 'test1'#'localhost';
Change credentials in your conf/application.conf:
db.default.user="test1"
db.default.pass="mypass"
Then run your application. This should work.
You have
Access denied for user 'root'#'localhost' (using password: YES)
check your credentials

Entity Framework & Reverse Engineer Code First & MySQL: error access denied

I'm trying to use Entity Framework Reverse Engineer Code First with MySQL DB, I have installed these: mysql-for-visualstudio-1.2.3 & mysql-connector-net-6.9.3
The connection to MySQL DB seems to work:
I get the following error:
System.Data.ProviderIncompatibleException: The provider did not return
a ProviderManifestToken string. --->
MySql.Data.MySqlClient.MySqlException: Authentication to host
'localhost' for user 'root' using method 'mysql_native_password'
failed with message: Access denied for user 'root'#'localhost' (using
password: NO) ---> MySql.Data.MySqlClient.MySqlException: Access
denied for user 'root'#'localhost' (using password: NO)
I tried a lot of solutions found on the internet but nothing works.
Here is the connection string I have in the web.config:
<add name="TFEContext" providerName="MySql.Data.MySqlClient" connectionString="server=localhost;
port=3306;database=tfe_schema;uid=root;password=********"/>
After 2 days of search, I checked the box "Save my password" and it's working but the password to access the MySQL server is hardcoded in the web.config.

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

Sonar SQLException when starting tomcat

I have been trying to install a new version of Sonar, however after this did not work (due to a table_lock error with the database migration) I have referred back to the original version 2.11. Now when I start tomcat I get this exception (attached). I have been changing the my.cnf and some things may have been reset.
In the catalina.out log I get this error:
... 42 common frames omitted
Caused by: java.sql.SQLException: Access denied for user 'sonar'#'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075) [mysql-connector-java-5.1.13.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566) [mysql-connector-java-5.1.13.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498) [mysql-connector-java-5.1.13.jar:na]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:919) [mysql-connector-java-5.1.13.jar:na]
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4004) [mysql-connector-java-5.1.13.jar:na]
Looks like your Sonar database no longer has access granted for the sonar user. To fix it, type "mysql" from a command prompt and do the following:
mysql> GRANT ALL ON your_sonar_database TO 'sonar#localhost' IDENTIFIED BY 'password_for_sonar_user';
mysql> FLUSH PRIVILEGES;
mysql> exit
Then restart the Sonar server and you should be good.