Category Archives: MySQL

[Solved] Navicat connection error 1251 compatibility with docker MySQL

# Modify the encryption rules
(1) ALTER USER ‘root’@’%’ IDENTIFIED BY ‘password’ PASSWORD EXPIRE NEVER;
# Update the user’s password
(2) ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘password’;
# Refresh permissions
(3)FLUSH PRIVILEGES;
reconnect the Navicat will solve the problem.

Mysql8.02/ubuntu 20 ERROR 1449 (HY000) [How to Solve]

Just after installing MySQL through apt install MySQL server, I encountered a pit. After checking for a long time, I finally found the answer. Thank you, netizens.

mysql> show databases;
ERROR 1449 (HY000): The user specified as a definer ('mysql.infoschema'@'localhost') does not exist

If you enter mysql, you will report an error. I don’t know why. Confused B

mysql> create user ' mysql.infoschema '@'% 'identified by' password ';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on *.* to 'mysql.infoschema'@'%';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

Mybatis Error setting non null for parameter #15 with JdbcType null Could not set parameters for

Caused by: org.apache.ibatis.type.TypeException: Error setting non null for parameter #15 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (15 > number of parameters, which is 14).
	at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:71)
	at com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler.setParameters(MybatisDefaultParameterHandler.java:227)
	... 88 more
Caused by: java.sql.SQLException: Parameter index out of range (15 > number of parameters, which is 14).

If a comment SQL fragment exists in the SQL code, the #{} parameter cannot be used in the comment SQL fragment. As follows:

        on t1.dealer_code = t4.dealer_code
        -- left join (
        --     select
        --         ads_code
        --        ,sum(case when car like '%MM%' or model = 'MM' then ss_num else 0 end) as ws_MM_num
        --     from abc_assss_ss
        --     where seq = 1 and count_date between '2021-04-01' and '2021-06-30'
        --     group by
        --         dealer_code
        --     )t2
        -- on t1.asd_code = t2.ads_code
        )
        select
      ~~~
      If you replace the between and with the parameter between #{start_time} and #{end_time}, it will report this error, hope it can solve your problem

IDEA maven Config MYSQL Connection Error: Could not create connection to database server.

Error message

2021.2\lib\idea_rt.jar;E:\IDEA\IDEA\IntelliJ IDEA 2021.2\plugins\junit\lib\junit5-rt.jar;E:\IDEA\IDEA\IntelliJ IDEA 2021.2\plugins\junit\lib\junit-rt.jar;E:\JDK1.8.301\jre\lib\charsets.jar;E:\JDK1.8.301\jre\lib\deploy.jar;E:\JDK1.8.301\jre\lib\ext\access-bridge-64.jar;E:\JDK1.8.301\jre\lib\ext\cldrdata.jar;E:\JDK1.8.301\jre\lib\ext\dnsns.jar;E:\JDK1.8.301\jre\lib\ext\jaccess.jar;E:\JDK1.8.301\jre\lib\ext\jfxrt.jar;E:\JDK1.8.301\jre\lib\ext\localedata.jar;E:\JDK1.8.301\jre\lib\ext\nashorn.jar;E:\JDK1.8.301\jre\lib\ext\sunec.jar;E:\JDK1.8.301\jre\lib\ext\sunjce_provider.jar;E:\JDK1.8.301\jre\lib\ext\sunmscapi.jar;E:\JDK1.8.301\jre\lib\ext\sunpkcs11.jar;E:\JDK1.8.301\jre\lib\ext\zipfs.jar;E:\JDK1.8.301\jre\lib\javaws.jar;E:\JDK1.8.301\jre\lib\jce.jar;E:\JDK1.8.301\jre\lib\jfr.jar;E:\JDK1.8.301\jre\lib\jfxswt.jar;E:\JDK1.8.301\jre\lib\jsse.jar;E:\JDK1.8.301\jre\lib\management-agent.jar;E:\JDK1.8.301\jre\lib\plugin.jar;E:\JDK1.8.301\jre\lib\resources.jar;E:\JDK1.8.301\jre\lib\rt.jar;C:\Users\13288\Desktop\heiMaProject\springIOC_Anno20210824\target\test-classes;C:\Users\13288\.m2\repository\mysql\mysql-connector-java\5.1.32\mysql-connector-java-5.1.32.jar;C:\Users\13288\.m2\repository\junit\junit\4.11\junit-4.11.jar;C:\Users\13288\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\13288\.m2\repository\com\alibaba\druid\1.1.10\druid-1.1.10.jar;C:\Users\13288\.m2\repository\c3p0\c3p0\0.9.1.2\c3p0-0.9.1.2.jar" com.intellij.rt.junit.JUnitStarter -ideVersion5 -junit4 com.sadhu.config.DataSourseConfiguration,test1
八月 24, 2021 5:19:38 下午 com.mchange.v2.log.MLog <clinit>
信息: MLog clients using java 1.4+ standard logging.
八月 24, 2021 5:19:39 下午 com.mchange.v2.c3p0.C3P0Registry banner
信息: Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug?true; trace: 10]
八月 24, 2021 5:19:39 下午 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 31snbdajx58efk1sewirk|379619aa, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> null, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 31snbdajx58efk1sewirk|379619aa, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:33061, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
八月 24, 2021 5:20:09 下午 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask run
警告: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@7ec906a6 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
	at sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
	at com.mysql.jdbc.Util.getInstance(Util.java:383)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1023)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2576)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2309)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
	at sun.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:419)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
	at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
	at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
	at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
	at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: java.lang.NullPointerException
	at com.mysql.jdbc.ConnectionImpl.getServerCharset(ConnectionImpl.java:3299)
	at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1967)
	at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1893)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1287)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2494)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2527)
	... 17 more

八月 24, 2021 5:20:09 下午 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask run
警告: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@47d734db -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
	at sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
	at com.mysql.jdbc.Util.getInstance(Util.java:383)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1023)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2576)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2309)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
	at sun.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:419)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
	at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
	at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
	at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
	at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: java.lang.NullPointerException
	at com.mysql.jdbc.ConnectionImpl.getServerCharset(ConnectionImpl.java:3299)
	at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1967)
	at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1893)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1287)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2494)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2527)
	... 17 more

八月 24, 2021 5:20:09 下午 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask run
警告: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@3f96684d -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
	at sun.reflect.GeneratedConstructorAccessor6.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
	at com.mysql.jdbc.Util.getInstance(Util.java:383)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1023)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:997)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:983)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:928)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2576)
	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2309)
	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
	at sun.reflect.GeneratedConstructorAccessor7.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:408)
	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:419)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:344)
	at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
	at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
	at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
	at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Caused by: java.lang.NullPointerException
	at com.mysql.jdbc.ConnectionImpl.getServerCharset(ConnectionImpl.java:3299)
	at com.mysql.jdbc.MysqlIO.sendConnectionAttributes(MysqlIO.java:1967)
	at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1893)
	at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1287)
	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2494)
	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2527)
	... 17 more


java.sql.SQLException: Connections could not be acquired from the underlying database!

	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)
	at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
	at com.sadhu.config.DataSourseConfiguration.test1(DataSourseConfiguration.java:17)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
	at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)
	at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
	at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
	... 24 more


Process finished with exit code -1

 

reason

The package version of the connection data is too low

Solution:

You can use a higher version

after modification, you can pass

MySQL (version 8.0) connection error: 1251 [How to Solve]

1. Error reporting

2. Reasons for error reporting

Because the encryption method of MySQL 8.0 is different from that of MySQL 5.0, an error will be reported when connecting

3. Solutions

You need to change the encryption method to connect successfully (follow the steps below).

1. Enter the DOS command and execute the following code to enter the database

mysql -uroot -proot //-u(database account) -p(database password)

2. Execute the following command

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password set during mysql installation';

You can also change the password with this command: change the password in the command to the new one

After completing the above two steps, there will be no error when connecting again.

Doris reports an error: error 1064 (HY000) [How to Solve]

1、Failed to get scan range, no queryable replica found in tablet
Error Message:
ERROR 1064 (HY000): errCode = 2, detailMessage = Failed to get scan range, no queryable replica found in tablet: 11018

MySQL [tpa]> select * from tpa.table1;
ERROR 1064 (HY000): errCode = 2, detailMessage = Failed to get scan range, no queryable replica found in tablet: 11018
MySQL [tpa]>

(1) Check the be cluster information and no problems are found

MySQL [tpa]> show backends \G
*************************** 1. row ***************************
BackendId: 11002
Cluster: default_cluster
IP: 10.17.12.158
HeartbeatPort: 9050
BePort: 9060
HttpPort: 8040
BrpcPort: 8060
LastStartTime: 2021-08-13 09:46:23
LastHeartbeat: 2021-08-25 16:35:22
Alive: true
SystemDecommissioned: false
ClusterDecommissioned: false
TabletNum: 11
DataUsedCapacity: 2.389 KB
AvailCapacity: 2.273 GB
TotalCapacity: 49.090 GB
UsedPct: 95.37 %
MaxDiskUsedPct: 95.37 %
ErrMsg:
Version: 0.14.7-Unknown
Status: {"lastSuccessReportTabletsTime":"2021-08-25 16:34:55"}
*************************** 2. row ***************************
BackendId: 11001
Cluster: default_cluster
IP: 10.17.12.159
HeartbeatPort: 9050
BePort: 9060
HttpPort: 8040
BrpcPort: 8060
LastStartTime: 2021-08-13 09:41:46
LastHeartbeat: 2021-08-25 16:35:22
Alive: true
SystemDecommissioned: false
ClusterDecommissioned: false
TabletNum: 15
DataUsedCapacity: 1.542 KB
AvailCapacity: 12.090 GB
TotalCapacity: 49.090 GB
UsedPct: 75.37 %
MaxDiskUsedPct: 75.37 %
ErrMsg:
Version: 0.14.7-Unknown
Status: {"lastSuccessReportTabletsTime":"2021-08-25 16:34:41"}
*************************** 3. row ***************************
BackendId: 10002
Cluster: default_cluster
IP: 10.17.12.160
HeartbeatPort: 9050
BePort: 9060
HttpPort: 8040
BrpcPort: 8060
LastStartTime: 2021-08-25 15:57:11
LastHeartbeat: 2021-08-25 16:35:22
Alive: true
SystemDecommissioned: false
ClusterDecommissioned: false
TabletNum: 10
DataUsedCapacity: 3.084 KB
AvailCapacity: 1.902 GB
TotalCapacity: 49.090 GB
UsedPct: 96.13 %
MaxDiskUsedPct: 96.13 %
ErrMsg:
Version: 0.14.7-Unknown
Status: {"lastSuccessReportTabletsTime":"2021-08-25 16:35:13"}
3 rows in set (0.00 sec)

MySQL [tpa]>

(2) Error in select query command

MySQL [tpa]>desc table1;
+----------+-------------+------+-------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-------+---------+-------+
| siteid | INT | Yes | true | 10 | |
| citycode | SMALLINT | Yes | true | NULL | |
| username | VARCHAR(32) | Yes | true | | |
| pv | BIGINT | Yes | false | 0 | SUM |
+----------+-------------+------+-------+---------+-------+
4 rows in set (0.00 sec)

MySQL [tpa]> select * from tpa.table1;
ERROR 1064 (HY000): errCode = 2, detailMessage = Failed to get scan range, no queryable replica found in tablet: 11018
MySQL [tpa]> select count(1) from table1 ;
ERROR 1064 (HY000): errCode = 2, detailMessage = Failed to get scan range, no queryable replica found in tablet: 11018
MySQL [tpa]>

2. Problem analysis and solution

(1) Problem analysis
in the first step, baidu received an error message and couldn’t find the corresponding error message. Didn’t everyone encounter the same error
in the second step, you can’t find a solution online, so you have to analyze it yourself. My English is very poor, but I can roughly guess that no queryable replica found in tablet roughly means that the corresponding queryable replica cannot be found in tablet. There may be a problem with the copy
the third step is to look up the replica information. I build the table according to the official document. The number of replicas is set to 1. The problem is that it is possible.

CREATE TABLE table1
(
    siteid INT DEFAULT '10',
    citycode SMALLINT,
    username VARCHAR(32) DEFAULT '',
    pv BIGINT SUM DEFAULT '0'
)
AGGREGATE KEY(siteid, citycode, username)
DISTRIBUTED BY HASH(siteid) BUCKETS 10
PROPERTIES("replication_num" = "1");

(2) Verify the conjecture
the first step is to create a table with 2 copies

MySQL [tpa]> CREATE TABLE t1
    -> (
    ->     siteid INT DEFAULT '10',
    ->     citycode SMALLINT,
    ->     username VARCHAR(32) DEFAULT '',
    ->     pv BIGINT SUM DEFAULT '0'
    -> )
    -> AGGREGATE KEY(siteid, citycode, username)
    -> DISTRIBUTED BY HASH(siteid) BUCKETS 10
    -> PROPERTIES("replication_num" = "2");
Query OK, 0 rows affected (1.20 sec)

MySQL [tpa]> exit
Bye

Step 2: import data

[root@node3 ~]# curl --location-trusted -u test:test -H "label:t1_20170707" -H "column_separator:," -T table1_data http://node3:8030/api/tpa/t1/_stream_load
{
    "TxnId": 428829,
    "Label": "t1_20170707",
    "Status": "Success",
    "Message": "OK",
    "NumberTotalRows": 5,
    "NumberLoadedRows": 5,
    "NumberFilteredRows": 0,
    "NumberUnselectedRows": 0,
    "LoadBytes": 55,
    "LoadTimeMs": 840,
    "BeginTxnTimeMs": 1,
    "StreamLoadPutTimeMs": 12,
    "ReadDataTimeMs": 0,
    "WriteDataTimeMs": 710,
    "CommitAndPublishTimeMs": 116
}

Step 3: execute the query and everything is normal.

[root@node3 ~]# mysql -h 10.17.12.160 -P 9030 -uroot -p123456
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.1.0 Baidu Doris version 0.14.7-Unknown

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> use tpa;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MySQL [tpa]> select count(1) from t1;
+----------+
| count(1) |
+----------+
|        5 |
+----------+
1 row in set (1.01 sec)

MySQL [tpa]> 

Preliminary conclusion: it may be due to the problem of the number of copies when creating the table, which needs further verification in the future

MySQL Error: [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file

In the environment with Wamp installed locally, MySQL fails to start at startup. Check the startup failure log as follows:

2021-08-21T12:46:57.183482Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file .\ibdata1 are 0x4800!
2021-08-21 20:46:57 0xf48  InnoDB: Assertion failure in thread 3912 in file ut0ut.cc line 942
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
12:46:57 UTC - mysqld got exception 0x80000003 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

Later, after checking online, many people reported this problem after using MySQL 8 and then MySQL 5.7, and then this is the case in my local area. Later, I checked the my.ini file and found that there was a problem with the directory pointing to the configuration dataDir. Just modify it.

Then start again and report the following error:

2021-08-21T12:57:29.873841Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2021-08-21T12:57:29.874698Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2021-08-21T12:57:29.875239Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-08-21T12:57:30.090440Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-08-21T12:57:30.091251Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-08-21T12:57:30.091811Z 0 [ERROR] Failed to initialize builtin plugins.
2021-08-21T12:57:30.092185Z 0 [ERROR] Aborting

Then delete the IB in the data directory under the MySQL installation directory according to the online method_logfile0 and IB_logfile1. If these two files cannot be deleted, find mysqld in the process list and end it.

Front end error: exceptionmessage: null [How to Solve]

When updating an interface written by others before debugging, the front end always reports an error, exceptionmessage: null, similar to this format

the Java code sends a put request, The parameter requires a class

this is the field to be transferred during swagger UI test

this is the field of this class in the database table

it is not difficult to find that there are more fields in the class than in the database table, The only fields in the SQL statement that need to be modified are these

so I changed all the parameters to be transmitted to the parameters required by the SQL statement. The test was successful


then go to the front end. The front end fields correspond to the fields of the SQL statement. Some fields have and some do not, The parameters required by SQL can be changed uniformly. There is an episode in the middle. The front-end field name is different from the back-end field name, and this error is also reported.

Summary:

Exceptionmessage: null is mostly due to the inconsistency between SQL fields and database table fields or the different definitions of front and rear field names

Mybatis Add Datas error: ERROR: Field * doesn‘t have a default value

Mybatis will report error: field * doesn’t have a default value after adding data

Article catalog

After mybatis adds data, it will report error: field * Don’t have a default value database table. If the same SQL is inserted into the database through mybatis, it will report an error. Do not insert the not null field, do not insert the nut null default field

How to design a general insert statement method 1: set the default value on the entity class method 2: use the label

Database table

CREATE TABLE `apply_log` (
  `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `exception_date` date NOT NULL DEFAULT '0000-00-00' COMMENT '异常日期',
  `apply_date` date NOT NULL DEFAULT '2021-00-00' COMMENT '申请日期',
  `apply_person` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '申请人',
  `apply_person_id` int(10) NOT NULL COMMENT '申请人id',
  `operate_person` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '审批人',
  `operate_person_id` int(10) NOT NULL COMMENT '审批人id',
  `apply_result` tinyint(1) NOT NULL COMMENT '申请结果,1.申请中.2.审批拒绝,3.审批同意',
  `comment` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '备注',
  `apply_id` int(10) NOT NULL COMMENT '绑定申请信息',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='异常申请操作日志'


exception_ The date setting is not empty, and the default value ‘0000-00-00’
Apply_ Date setting is not empty, and the default value ‘2021-00-00’
other fields are not empty, and there is no default value.

Now start inserting data into the database

INSERT INTO apply_log(apply_person) VALUES('yyds');

Execution result

if not null is set in mysql, the default value of data type is 0000-00-00, the default value of int is 0, and the default value of varchar type is empty string

If the same SQL is inserted into the database through mybatis, an error will be reported

Do not insert not null fields

Entity class

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ApplyLog1 {
   private Integer id;
   private String exceptionDate; 
   private String applyDate;
   private String applyPerson;
   private Integer applyPersonId;
   private String operatePerson;
   private Integer operatePersonId;
   private Integer applyResult;
   private String comment ;
   private Integer applyId ;
}

mybatis

    <insert id="insertGao" >
        INSERT INTO apply_log(apply_person) VALUE ('17yyds')
    </insert>

mapper

Integer insertGao();

Execute direct report apply_ person_ ID is not empty. The default value of mybatis does not take effect

Do not insert nut null default field

xml层
    <insert id="insertTwo">
        insert into apply_log(apply_person,apply_person_id,operate_person,operate_person_id,apply_result
                             ,comment,apply_id) values ('1111',1111,'1111',1111,2,'1111',11)
    </insert>
 mapper层
    Integer insertTwo();
        @Test
    public void test8() {
        applyLog1Mapper.insertTwo();
    }

Insertion succeeded
non empty fields with their own default values can be successfully inserted, and the default value is used for relevant fields

How to design general insert statements

xml层
    <insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
        insert into apply_log(exception_date,apply_date,apply_person,apply_person_id,operate_person,operate_person_id,apply_result
        ,comment,apply_id) values (#{applyLog.exceptionDate},#{applyLog.applyDate},#{applyLog.applyPerson},#{applyLog.applyPersonId}
        ,#{applyLog.operatePerson},#{applyLog.operatePersonId},#{applyLog.applyResult},#{applyLog.comment},#{applyLog.applyId})
    </insert>
mapper层
	Integer insert(@Param("applyLog") ApplyLog1 applyLog);

if no default value is set for the attribute of the entity class, the default value of the encapsulation type is null, so an error will be reported during insertion


    @Test
    public void test9() {
        ApplyLog1 applyLog1 = new ApplyLog1();
        applyLog1.setApplyPerson("18yyds");
        applyLog1Mapper.insert(applyLog1);
    }

All inserted values are null

Method 1: set the default value on the entity class

When the new object is, make the entity class set the initial value

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ApplyLog1 {
    private Integer id;
    private String exceptionDate="0000-00-00";
    private String applyDate="2021-00-00";
    private String applyPerson="19yyds";
    private Integer applyPersonId=19;
    private String operatePerson="19yyds";
    private Integer operatePersonId=19;
    private Integer applyResult=2;
    private String comment="19yyds";
    private Integer applyId=89;
}

Perform test

    @Test
    public void test9() {
        ApplyLog1 applyLog1 = new ApplyLog1();
        applyLog1.setApplyPerson("独孤求败");
        applyLog1Mapper.insert(applyLog1);
    }

Insert succeeded and the default value of entity class is used
[ Insert picture description here]( https://img-blog.csdnimg.cn/94ccd730abf64893b8927361163fc4b2.png

Method 2: use labels

Modify the table structure to establish default values for all fields

Create Table

CREATE TABLE `apply_log` (
 `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
 `exception_date` date NOT NULL DEFAULT '0000-00-00' COMMENT '异常日期',
 `apply_date` date NOT NULL DEFAULT '2021-00-00' COMMENT '申请日期',
 `apply_person` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '申请人',
 `apply_person_id` int(10) NOT NULL COMMENT '申请人id',
 `operate_person` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '审批人',
 `operate_person_id` int(10) NOT NULL COMMENT '审批人id',
 `apply_result` tinyint(1) NOT NULL COMMENT '申请结果,1.申请中.2.审批拒绝,3.审批同意',
 `comment` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '备注',
 `apply_id` int(10) NOT NULL COMMENT '绑定申请信息',
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='异常申请操作日志'

Entity class

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ApplyLog1 {
   private Integer id;
   private String exceptionDate;
   private String applyDate;
   private String applyPerson;
   private Integer applyPersonId;
   private String operatePerson;
   private Integer operatePersonId;
   private Integer applyResult;
   private String comment;
   private Integer applyId;
}

Mapper, use the tag to remove the redundant “,” characters that may appear at the beginning and end of the fragment

    <insert id="insertThree" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
       insert into apply_log(<include refid="baseColumn"></include>) values (<include refid="baseProperty"></include>)
   </insert>
   <sql id="baseColumn">
       <trim suffixOverrides=",">
           <if test="applyLog.exceptionDate != null">exception_date,</if>
           <if test="applyLog.applyDate != null">apply_date,</if>
           <if test="applyLog.applyPerson != null">apply_person,</if>
           <if test="applyLog.applyPersonId != null">apply_person_id,</if>
           <if test="applyLog.operatePerson != null">operate_person,</if>
           <if test="applyLog.operatePersonId != null">operate_person_id,</if>
           <if test="applyLog.applyResult != null">apply_result,</if>
           <if test="applyLog.comment != null">comment,</if>
           <if test="applyLog.applyId != null">apply_id,</if>
       </trim>
   </sql>

   <sql id="baseProperty">
       <trim suffixOverrides=",">
           <if test="applyLog.exceptionDate != null">#{applyLog.exceptionDate},</if>
           <if test="applyLog.applyDate != null">#{applyLog.applyDate},</if>
           <if test="applyLog.applyPerson != null">#{applyLog.applyPerson},</if>
           <if test="applyLog.applyPersonId != null">#{applyLog.applyPersonId},</if>
           <if test="applyLog.operatePerson != null">#{applyLog.operatePerson},</if>
           <if test="applyLog.operatePersonId != null">#{applyLog.operatePersonId},</if>
           <if test="applyLog.applyResult != null">#{applyLog.applyResult},</if>
           <if test="applyLog.comment != null">#{applyLog.comment},</if>
           <if test="applyLog.applyId != null">#{applyLog.applyId},</if>
       </trim>
   </sql>

Use relevant methods

    @Test
    public void test10() {
        ApplyLog1 applyLog1 = new ApplyLog1();
        applyLog1.setApplyPerson("天下无敌");
        applyLog1Mapper.insertThree(applyLog1);
    }

Successfully inserted

MySQL Error: errorCode 1130, state HY000 [How to Solve]

MySQL reports an error: errorcode 1130, state HY000

Scenario: the following error is reported during springboot startup:

 

The XML configuration is as follows:

 

It can be started normally when writing 127.0.0.1 or localhost. After rewriting 192.168. X.x, an Error 1130 is reported.

Reason: MySQL does not have this permission

Solution:

    1. switch to the MySQL installation directory and execute: MySQL – U root – P enter the password

    1. execute the command to authorize the user: grant all privileges on. To ‘root’ @ ‘%’ identified by ‘root’; (%) It means that after all ip

    1. execute the above commands, refresh the permissions with the following command: flush privileges

    restart MySQL service

MySQL Change password failure prompt: ERROR 1064(42000):You have an error in your SQL syntax: check the corresponds to your M

The tried methods all prompt similar errors

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '("123456") where user="root"' at line 1

Update user statement

UPDATE user SET password=PASSWORD('123456') WHERE user='root';
FLUSH PRIVILEGES;

Set password statement

SET PASSWORD FOR root=PASSWORD('123456');

authentication_string change

update mysql.user set authentication_string=password('123456') where user='root' ;

Final solution

mysql> SET PASSWORD = '123456';

[Solved] ERROR 1054 (42S22): Unknown column ‘password‘ in ‘field list‘

I don’t remember the MySQL login password. I couldn’t log in. I wanted to modify the MySQL password, but an error was reported
ERROR 1054 (42S22): Unknown column ‘password’ in ‘field list’

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set password="123" where user="root";
ERROR 1054 (42S22): Unknown column 'password' in 'field list'

Looking at the table in detail, it is found that there is no password field in the table, and the password field is changed to authentication_ String, as follows:

mysql> desc user;
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Field                  | Type                              | Null | Key | Default               | Extra |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Host                   | char(60)                          | NO   | PRI |                       |       |
| User                   | char(32)                          | NO   | PRI |                       |       |
| Select_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Insert_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Update_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Delete_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Create_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Drop_priv              | enum('N','Y')                     | NO   |     | N                     |       |
| Reload_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Shutdown_priv          | enum('N','Y')                     | NO   |     | N                     |       |
| Process_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| File_priv              | enum('N','Y')                     | NO   |     | N                     |       |
| Grant_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| References_priv        | enum('N','Y')                     | NO   |     | N                     |       |
| Index_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Alter_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Show_db_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Super_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Create_tmp_table_priv  | enum('N','Y')                     | NO   |     | N                     |       |
| Lock_tables_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Execute_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Repl_slave_priv        | enum('N','Y')                     | NO   |     | N                     |       |
| Repl_client_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Create_view_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Show_view_priv         | enum('N','Y')                     | NO   |     | N                     |       |
| Create_routine_priv    | enum('N','Y')                     | NO   |     | N                     |       |
| Alter_routine_priv     | enum('N','Y')                     | NO   |     | N                     |       |
| Create_user_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Event_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Trigger_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Create_tablespace_priv | enum('N','Y')                     | NO   |     | N                     |       |
| ssl_type               | enum('','ANY','X509','SPECIFIED') | NO   |     |                       |       |
| ssl_cipher             | blob                              | NO   |     | NULL                  |       |
| x509_issuer            | blob                              | NO   |     | NULL                  |       |
| x509_subject           | blob                              | NO   |     | NULL                  |       |
| max_questions          | int(11) unsigned                  | NO   |     | 0                     |       |
| max_updates            | int(11) unsigned                  | NO   |     | 0                     |       |
| max_connections        | int(11) unsigned                  | NO   |     | 0                     |       |
| max_user_connections   | int(11) unsigned                  | NO   |     | 0                     |       |
| plugin                 | char(64)                          | NO   |     | mysql_native_password |       |
| authentication_string  | text                              | YES  |     | NULL                  |       |
| password_expired       | enum('N','Y')                     | NO   |     | N                     |       |
| password_last_changed  | timestamp                         | YES  |     | NULL                  |       |
| password_lifetime      | smallint(5) unsigned              | YES  |     | NULL                  |       |
| account_locked         | enum('N','Y')                     | NO   |     | N                     |       |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
45 rows in set (0.00 sec)

Solution:

mysql> update user set authentication_string="123" where user="root";        
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> select user,authentication_string from user where user="root";
+------+-----------------------+
| user | authentication_string |
+------+-----------------------+
| root | 123                   |
+------+-----------------------+
1 row in set (0.00 sec)