Category Archives: MySQL

[Solved] MySQL Error: ERROR 1055 (42000)sql_mode=only_full_group_by

environment

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.16    |
+-----------+

Execute query statement

mysql> select * from my_student;
+----+--------+----------+------+--------+
| id | name   | class_id | age  | gender |
+----+--------+----------+------+--------+
|  1 | 刘备   |        1 |   18 |      2 |
|  2 | 李四   |        1 |   19 |      1 |
|  3 | 王五   |        2 |   20 |      2 |
|  4 | 张飞   |        2 |   21 |      1 |
|  5 | 关羽   |        1 |   22 |      2 |
|  6 | 曹操   |        1 |   20 |   NULL |
+----+--------+----------+------+--------+
6 rows in set (0.00 sec)

-- Requirement: After sorting by age, take out the oldest students in each class
select * from (
    select * from my_student order by age desc
) as t group by t.class_id;

report errors

ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause 
and contains nonaggregated column 't.id' 
which is not functionally dependent on columns in GROUP BY clause; 
this is incompatible with sql_mode=only_full_group_by

reason:

MySQL 5.7.5 and above function dependency detection function

Solution:

-- View current configuration items
select @@global.sql_mode

-- remove ONLY_FULL_GROUP_BY
set @@global.sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

After setting, if it does not take effect, you can exit and log in again

[Solved] Manifest merger failed: Apps targeting Android 12 and higher are required to specify an explicit va

Manifest merge failed: when the corresponding component defines an intention filter, you need to specify an explicit value for Android: exported for Android 12 and later applications. See https:developer.android.comguidetopicsmanifestactivity-elementexported.

Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

Solution:

1. you need add  Android:exported to specify an explicit value

2. Add android:exported = "true" in the list file.

Android connection to cloud MySQL error: java.lang.NoClassDefFoundError Failed resolution of LjavasqlSQLType

The error information is as follows:

E/AndroidRuntime: FATAL EXCEPTION: Thread-4
    Process: com.example.NCEPU, PID: 19597
    java.lang.NoClassDefFoundError: Failed resolution of: Ljava/sql/SQLType;
        at com.mysql.cj.jdbc.DatabaseMetaData.getInstance(DatabaseMetaData.java:746)
        at com.mysql.cj.jdbc.ConnectionImpl.getMetaData(ConnectionImpl.java:1170)
        at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447)
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197)
        at java.sql.DriverManager.getConnection(DriverManager.java:580)
        at java.sql.DriverManager.getConnection(DriverManager.java:218)
        at com.example.NCEPU.Utils.MySQLUtil$1.run(MySQLUtil.java:20)
        at java.lang.Thread.run(Thread.java:929)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "java.sql.SQLType" on path: DexPathList[[zip file "/data/app/com.example.NCEPU-ONfkLzQBKVHb0mVXKR3p5g==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.NCEPU-ONfkLzQBKVHb0mVXKR3p5g==/lib/arm64, /data/app/com.example.NCEPU-ONfkLzQBKVHb0mVXKR3p5g==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64, /hw_product/lib64, /system/product/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at com.mysql.cj.jdbc.DatabaseMetaData.getInstance(DatabaseMetaData.java:746) 
        at com.mysql.cj.jdbc.ConnectionImpl.getMetaData(ConnectionImpl.java:1170) 
        at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447) 
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) 
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:197) 
        at java.sql.DriverManager.getConnection(DriverManager.java:580) 
        at java.sql.DriverManager.getConnection(DriverManager.java:218) 
        at com.example.NCEPU.Utils.MySQLUtil$1.run(MySQLUtil.java:20) 
        at java.lang.Thread.run(Thread.java:929) 
W/libEGL: EGLNativeWindowType 0x6f3882b950 disconnect failed
I/Process: Sending signal. PID: 19597 SIG: 9

Problem analysis: the jar package version of MySQL is too high. I used the latest version: mysql-connector-java-8.0.21.jar, loading driver:

Class.forName("com.mysql.cj.jdbc.Driver");
String url = "jdbc:mysql://yourip:port/sheetname?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC";
connection = DriverManager.getConnection(url, user, password);

Problem solved: jar version lower, here I used the official website to download mysql-connector-java-5.1.49.jar, note that after changing to a lower version to load the driver to become.

Class.forName("com.mysql.jdbc.Driver");

Oracle11g Startup Database Error: ORA-27154: post/wait create failed

ORA-27154: post/wait create failed
This error is due to the failure of obtaining the OS semaphore (semaphore can be understood as memory lock) during the startup process, and the process needs to obtain the semaphore before requesting memory for use.
Generally, the processes parameter in oracle is set to processes*2+15 during installation is safer.

Usually the error ORA-27154: post/wait create failed is accompanied by the following errors.
ORA-27300: OS system dependent operation:semget failed with status: 28
ORA-27301: OS failure message: No space left on device
ORA-27302: failure occurred at: sskgpcreates
These errors are caused by the fact that the processed is too large and the amount of signals to be acquired is not enough.

Check the current settings
[oracle@ebsse oracle]$ cat /proc/sys/kernel/sem
250 32000 100 128

The 4 data items correspond to SEMMSL SEMMNS SEMOPM SEMMNI
Instead of explaining the meaning of the data, let's just talk about the modification.

Change the value of sem to: 5010 641280 5010 128

For automatic application at boot time, add to /etc/sysctl.conf:
kernel.sem =5010 641280 5010 128

sysctl -p

[Solved] Navicat Connect MySQL error: Authentication plugin ‘caching_sha2_password‘ cannot be loaded

The reason for this problem is: the different encryption rules before and after MySQL8 cause the problem, now let’s deal with it.

Windows system operation steps, Linux can refer to

Run CMD with administrator command

mysql -u root -p

If the command fails, the environment variable is not configured. After configuring the environment variable, execute it, or go to the bin folder of MySQL installation directory to execute the above statement.

Modify encryption rules

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;

update user password

 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

refresh permission

 FLUSH PRIVILEGES;

reset password

ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEW_PASSWORD';

After the modification is completed, go to Navicat to test the connection, and you can succeed.

[Solved] init datasource error, url: jdbc:mysql://lcoalhost:3306/test com.mysql.cj.jdbc.exceptions.Com

Error message:

com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.18.jar:8.0.18]
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.18.jar:8.0.18]
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:836) ~[mysql-connector-java-8.0.18.jar:8.0.18]
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456) ~[mysql-connector-java-8.0.18.jar:8.0.18]
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246) ~[mysql-connector-java-8.0.18.jar:8.0.18]
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) ~[mysql-connector-java-8.0.18.jar:8.0.18]
	at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:156) ~[druid-1.1.10.jar:1.1.10]
	at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:218) ~[druid-1.1.10.jar:1.1.10]
	at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150) ~[druid-1.1.10.jar:1.1.10]
	at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1560) ~[druid-1.1.10.jar:1.1.10]
	at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1623) ~[druid-1.1.10.jar:1.1.10]
	at com.alibaba.druid.pool.DruidDataSource.init(DruidDataSource.java:861) ~[druid-1.1.10.jar:1.1.10]
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1229) ~[druid-1.1.10.jar:1.1.10]
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:1225) ~[druid-1.1.10.jar:1.1.10]
	at com.alibaba.druid.pool.DruidDataSource.getConnection(DruidDataSource.java:90) ~[druid-1.1.10.jar:1.1.10]
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doBegin(DataSourceTransactionManager.java:263) ~[spring-jdbc-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:376) ~[spring-tx-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:560) ~[spring-tx-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:347) ~[spring-tx-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:99) ~[spring-tx-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:747) ~[spring-aop-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) ~[spring-aop-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at com.baidu.fsg.uid.worker.DisposableWorkerIdAssigner$$EnhancerBySpringCGLIB$$17ab474d.assignWorkerId(<generated>) ~[classes/:?]
	at com.baidu.fsg.uid.impl.DefaultUidGenerator.afterPropertiesSet(DefaultUidGenerator.java:89) ~[classes/:?]
	at com.baidu.fsg.uid.impl.CachedUidGenerator.afterPropertiesSet(CachedUidGenerator.java:69) ~[classes/:?]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1862) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1799) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:537) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:513) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:653) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:224) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:334) ~[spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1429) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) [spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) [spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) [spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) [spring-beans-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) [spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) [spring-context-5.2.0.RELEASE.jar:5.2.0.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) [spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.0.RELEASE.jar:2.2.0.RELEASE]
	at cn.com.icbf.framework.uid.UidStartApplication.main(UidStartApplication.java:20) [classes/:?]
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

Solution:

This is because MySQL needs to specify whether to connect with SSL in the higher version: ?useSSL=false

Redis Delete dump.rdb Mistakenly [How to Solve]

1. Log in to redis database

[ root@localhost ~]# redis-cli -h 192.168.1.19
2. View redis configuration information

192.168.1.19:6379> info

2. According the path of config_file to set dump.rdb file storage path, or you can customize the path

192.168.1.19:6379> config set dir /storage/redis/

3. Save and exit

192.168.1.19:6379> save

192.168.1.19:6379> exit

4. Restart redis service

[ root@localhost ~]# service redis stop

[ root@localhost ~]# service redis start

[Solved] Mysql Close safe-updates Mode Error: Error Code: 1175

When this problem occurs in MySQL database:

Error Code: 1175. You are using safe update mode and you tried to update a table without a
WHERE  that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL 
Editor and reconnect.

MySQL has entered the safe mode, which is the safe updates mode

Solution:


SHOW VARIABLES like 'sql_safe_updates';  # Query the status of the current safe-updates mode
SET sql_safe_updates=0; # Turn off safe-updates mode

ORA-04088: error during execution of trigger [How to Solve]

ORA-00001: unique constraint XXXXXXX violated
ORA-06512: at “XXXXXXXXX”, line 5
ORA-04088: error during execution of trigger ‘TRRIGER_ NAME’

This is mostly because trrigger is in use. This error will be reported if it performs merge into operation or inserts or updates the target table.

Solution: close trrigger and execute merge into, insert and update statements.

alter trigger trriger_name disable;

After executing the statement, turn on trrigger.

alter trigger trriger_name enable;

Disadvantages:

Data loss may occur between disable and enable.