I know this question asked already but those answers are not helping in any way.
I am spending more time to configure mysql with hive, Every time I encounter errors and
Problem was with hive-site.xml file and this configuration helped me to resolve the issue.
javax.jdo.option.ConnectionURL
jdbc:mysql://localhost/metastore_db?createDatabaseIfNotExist=true
metadata is stored in a MySQL server
javax.jdo.option.ConnectionDriverName
com.mysql.jdbc.Driver
MySQL JDBC driver class
javax.jdo.option.ConnectionUserName
hiveuser
user name for connecting to mysql server
javax.jdo.option.ConnectionPassword
hivepassword
password for connecting to mysql server
javax.jdo.PersistenceManagerFactoryClass
org.datanucleus.api.jdo.JDOPersistenceManagerFactory
class implementing the jdo persistence
javax.jdo.option.DetachAllOnCommit
true
detaches all objects from session so that they can be used after transaction is committed
javax.jdo.option.NonTransactionalRead
true
reads outside of transactions
javax.jdo.option.Multithreaded
true
Set this to true if multiple threads access metastore through JDO concurrently.
datanucleus.validateTables
false
validates existing schema against code. turn this on if you want to verify existing schema
datanucleus.validateColumns
false
validates existing schema against code. turn this on if you want to verify existing schema
datanucleus.validateConstraints
false
validates existing schema against code. turn this on if you want to verify existing schema
datanucleus.storeManagerType
rdbms
metadata store type
datanucleus.autoCreateSchema
false
datanucleus.autoStartMechanismMode
checked
throw exception if metadata tables are incorrect
datanucleus.autoStartMechanism
SchemaTable
datanucleus.fixedDatastore
true
datanucleus.transactionIsolation
read-committed
Default transaction isolation level for identity generation.
datanucleus.cache.level2
false
Use a level 2 cache. Turn this off if metadata is changed independently of Hive metastore server
datanucleus.cache.level2.type
SOFT
SOFT=soft reference based cache, WEAK=weak reference based cache.
datanucleus.identifierFactory
datanucleus1
Name of the identifier factory to use when generating table/column names etc. 'datanucleus1' is used for backward compatibility with DataNucleus v1
datanucleus.plugin.pluginRegistryBundleCheck
LOG
Defines what happens when plugin bundles are found and are duplicated [EXCEPTION|LOG|NONE]
hive.metastore.warehouse.dir
/user/hive/warehouse
location of default database for the warehouse
hive.metastore.execute.setugi
false
In unsecure mode, setting this property to true will cause the metastore to execute DFS operations using the client's reported user and group permissions. Note that this property must be set on both the client and server sides. Further note that its best effort. If client sets its to true and server sets it to false, client setting will be ignored.
hive.metastore.event.listeners
list of comma separated listeners for metastore events.
hive.metastore.partition.inherit.table.properties
list of comma separated keys occurring in table properties which will get inherited to newly created partitions. * implies all the keys will get inherited.
hive.metadata.export.location
When used in conjunction with the org.apache.hadoop.hive.ql.parse.MetaDataExportListener pre event listener, it is the location to which the metadata will be exported. The default is an empty string, which results in the metadata being exported to the current user's home directory on HDFS.
hive.metadata.move.exported.metadata.to.trash
When used in conjunction with the org.apache.hadoop.hive.ql.parse.MetaDataExportListener pre event listener, this setting determines if the metadata that is exported will subsequently be moved to the user's trash directory alongside the dropped table data. This ensures that the metadata will be cleaned up along with the dropped table data.
hive.metastore.partition.name.whitelist.pattern
Partition names will be checked against this regex pattern and rejected if not matched.
hive.metastore.disallow.incompatible.col.type.change
If true (default is false), ALTER TABLE operations which change the type of a column (say STRING) to an incompatible type (say MAP<STRING, STRING>) are disallowed. RCFile default SerDe (ColumnarSerDe) serializes the values in such a way that the datatypes can be converted from string to any type. The map is also serialized as a string, which can be read as a string as well. However, with any binary serialization, this is not true. Blocking the ALTER TABLE prevents ClassCastExceptions when subsequently trying to access old partitions. Primitive types like INT, STRING, BIGINT, etc are compatible with each other and are not blocked.
See HIVE-4409 for more details.
hive.metastore.end.function.listeners
list of comma separated listeners for the end of metastore functions.
hive.metastore.event.expiry.duration
0
Duration after which events expire from events table (in seconds)
hive.metastore.event.clean.freq
0
Frequency at which timer task runs to purge expired events in metastore(in seconds).
hive.metastore.connect.retries
5
Number of retries while opening a connection to metastore
hive.metastore.failure.retries
3
Number of retries upon failure of Thrift metastore calls
hive.metastore.client.connect.retry.delay
1
Number of seconds for the client to wait between consecutive connection attempts
hive.metastore.client.socket.timeout
20
MetaStore Client socket timeout in seconds
hive.metastore.rawstore.impl
org.apache.hadoop.hive.metastore.ObjectStore
Name of the class that implements org.apache.hadoop.hive.metastore.rawstore interface. This class is used to store and retrieval of raw metadata objects such as table, database
hive.metastore.batch.retrieve.max
300
Maximum number of objects (tables/partitions) can be retrieved from metastore in one batch. The higher the number, the less the number of round trips is needed to the Hive metastore server, but it may also cause higher memory requirement at the client side.
hive.metastore.batch.retrieve.table.partition.max
1000
Maximum number of table partitions that metastore internally retrieves in one batch.
hive.metastore.uris
thrift://localhost:9083
Hive metastore Thrift server
mapred.reduce.tasks
-1
The default number of reduce tasks per job. Typically set to a prime close to the number of available hosts. Ignored when mapred.job.tracker is "local". Hadoop set this to 1 by default, whereas Hive uses -1 as its default value. By setting this property to -1, Hive will automatically figure out what should be the number of reducers.
hive.cli.print.header
false
Whether to print the names of the columns in query output.
hive.cli.print.current.db
false
Whether to include the current database in the Hive prompt.
hive.cli.prompt
hive
Command line prompt configuration value. Other hiveconf can be used in this configuration value. Variable substitution will only be invoked at the Hive
CLI startup.
hive.test.mode
false
Whether Hive is running in test mode. If yes, it turns on sampling and prefixes the output tablename.
hive.test.mode.prefix
test_
if Hive is running in test mode, prefixes the output table by this string
hive.test.mode.samplefreq
32
if Hive is running in test mode and table is not bucketed, sampling frequency
hive.test.mode.nosamplelist
if Hive is running in test mode, don't sample the above comma separated list of tables
hive.metastore.uris
Thrift URI for the remote metastore. Used by metastore client to connect to remote metastore.