In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Hive even MySQL database creation table Times wrong how to do, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
1. Error message:
2018-06-01 14 DataNucleus.Datastore 44Zhou 20644 ERROR [main]: DataNucleus.Datastore (Log4JLogger.java:error (115))-Error thrown executing CREATE TABLE `TABLE_ PARAMS`
(
`TBL_ ID`BIGINT NOT NULL
`PARAM_ KEY` VARCHAR (256) BINARY NOT NULL
`PARAM_ Value` VARCHAR (4000) BINARY NULL
CONSTRAINT `TABLE_PARAMS_ PK` PRIMARY KEY (`TBL_ ID`, `PARAM_ KEY`)
) ENGINE=INNODB: Specified key was too long; max key length is 767bytes
Com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
At sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
At sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62)
At sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
At java.lang.reflect.Constructor.newInstance (Constructor.java:422)
At com.mysql.jdbc.Util.handleNewInstance (Util.java:406)
At com.mysql.jdbc.Util.getInstance (Util.java:381)
At com.mysql.jdbc.SQLError.createSQLException (SQLError.java:1030)
At com.mysql.jdbc.SQLError.createSQLException (SQLError.java:956)
At com.mysql.jdbc.MysqlIO.checkErrorPacket (MysqlIO.java:3515)
At com.mysql.jdbc.MysqlIO.checkErrorPacket (MysqlIO.java:3447)
At com.mysql.jdbc.MysqlIO.sendCommand (MysqlIO.java:1951)
At com.mysql.jdbc.MysqlIO.sqlQueryDirect (MysqlIO.java:2101)
At com.mysql.jdbc.ConnectionImpl.execSQL (ConnectionImpl.java:2548)
At com.mysql.jdbc.ConnectionImpl.execSQL (ConnectionImpl.java:2477)
At com.mysql.jdbc.StatementImpl.execute (StatementImpl.java:741)
At com.mysql.jdbc.StatementImpl.execute (StatementImpl.java:587)
At com.jolbox.bonecp.StatementHandle.execute (StatementHandle.java:254)
At org.datanucleus.store.rdbms.table.AbstractTable.executeDdlStatement (AbstractTable.java:760)
At org.datanucleus.store.rdbms.table.AbstractTable.executeDdlStatementList (AbstractTable.java:711)
At org.datanucleus.store.rdbms.table.AbstractTable.create (AbstractTable.java:425)
At org.datanucleus.store.rdbms.table.AbstractTable.exists (AbstractTable.java:488)
At org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.performTablesValidation (RDBMSStoreManager.java:3380)
At org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.addClassTablesAndValidate (RDBMSStoreManager.java:3190)
At org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.run (RDBMSStoreManager.java:2841)
At org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute (AbstractSchemaTransaction.java:122)
two。 Solution:
Modify the code of "hive database" in MySQL database and execute the command under MySQL: alter database hive database character set latin1
After hive starts, the specified database is created in the MySQL database. Ruozedb is the MySQL in the hive.site.xml file that connects to the database specified by URL.
2.1 Log in to the MySQL database to view Database:
Mysql > show databases
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | ruozedb |
| | test |
+-+
5 rows in set (0.00 sec)
2.2 do the following in the MySQL database:
Mysql > alter database ruozedb character set latin1
Query OK, 1 row affected (0.00 sec)
2.3 execute the creation script in hive
Hive > show databases
OK
Default
Time taken: 2.158 seconds, Fetched: 1 row (s)
Hive > create table psn_info (id int, name varchar, age int, tel varchar, email varchar)
OK
Time taken: 2.913 seconds
Hive > show tables
OK
Psn_info
Time taken: 0.132 seconds, Fetched: 1 row (s)
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.