Tag Archives: mysql

Linux Error: audit: backlog limit exceeded [How to Solve]

Phenomenon description:

Linux SSH cannot be connected and can be pinged. The login interface will give an error prompt audit: backlog limit exceeded

audit:backlog limit exceeded audit:backlog limit exceeded audit:backlog limit exceeded audit:backlog limit exceeded audit:backlog limit exceeded audit:backlog limit exceeded audit:backlog limit exceeded audit:backlog limit exceeded ...

Cause analysis:

The error is Linux kernel logs. The reason for the problem is that the audit service performs audit event operations in a busy system, and there is a bottleneck in the buffer, resulting in the system near crash.

Background:

Audit is a service used to record the user’s underlying calls in Linux system. It is used to record the user’s open, exit and other system calls, and write the records to the log file. Audit can add or delete audit rules by using the auditctl command. You can set recording for a user or for a process.

Main command: auditctl audit rules & amp; The system management tool is used to obtain status, add and delete monitoring rules, audit search query audit log tool, and audit report output audit system report

Solution:

You can try to increase the audit buffer to solve this problem.

The default memory page size for Linux is 4096 bytes. You can obtain the page size through the following command: getconf page_ Size, which can be set to N times of paging

View help auditctl – H

View the current default configuration auditctl – S

backlog_ Limit 320 # my centos7 1 only 320 by default

Optimize the audit service and modify the buffer size auditctl – B 8192. If not set, the system defaults to 64bytes

Settings take effect permanently:

Method 1) modify the rule configuration VIM/etc/audit/audit Rules - D - B 8192 - F 1 Parameter Description: – D delete all rules – B set the audit buffer size. If the buffer is full, the kernel will issue a failure flag – f [0|1|2] set the level of audit acquisition error. There are three values of 0/1/2. 0 is no log output; 1 is the output printk log; 2 is the highest level and will output a large amount of log information -e [0|1] enable/disable audit

Method 2) you can also set CHMOD U + X/etc/rc d/rc. local vim /etc/rc. d/rc. local auditctl -b 8192

[Solved] asp.NETCORE connect to MySQL error: encoding 1252

The error information is as follows:

System.NotSupportedException:“No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.”

Solution:

Add system.Through.nuget.Text.Encoding and system.Text.Encoding.References to codepages

Then add the following code to the code

System.Text.EncodingProvider ppp = System.Text.CodePagesEncodingProvider.Instance;
Encoding.RegisterProvider(ppp);

OK solve the problem

[Solved] MySQL workbench Error: SSL connection error: SSL is required but the server doesn‘t support it.

Question:

MySQL workbench 8.0. The 27 version connects to the local MySQL database and reports SSL connection error: SSL is required but the server doesn’t support it

Solution:

If SSL is not enabled, enter the parameter: usessl = 0 in the others box on the advance tab page, and then you can connect.

How to Solve mysqld — console command error

My error report is like the following picture

The prompt is as follows: an error is reported

 2021-12-26T12:28:24.321789Z 0 [System] [MY-010116] [Server] C:\mysql-8.0.26-winx64\bin\mysqld.exe (mysqld 8.0.26) starting as process 8168
2021-12-26T12:28:24.323688Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-12-26T12:28:24.335659Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-12-26T12:28:24.337392Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2021-12-26T12:28:24.337508Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2021-12-26T12:28:24.337618Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2021-12-26T12:28:24.337878Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2021-12-26T12:28:24.337978Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-12-26T12:28:24.338395Z 0 [System] [MY-010910] [Server] C:\mysql-8.0.26-winx64\bin\mysqld.exe: Shutdown complete (mysqld 8.0.26)  MySQL Community Server - GPL.

Reason guess:

The MySQL service is always turned on (it starts automatically after startup), so when it is turned on, an error will be reported when the command line is started

Solution:

Enter the command prompt in administrator mode and enter the following command to close the MySQL service

net stop mysql

So far, the problem has been solved. Entering mysqld — console again will open the MySQL service normally

CMake Error :MYSQL_INCLUDE_DIR [How to Solve]

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
xxxx/MYSQL_INCLUDE_DIR

Solution: yum install mysql-devel

Other missing boost/cmake etc. can be installed by compiling the source code.

cmake-3.8.2.tar.gz
boost_1_78_0.tar.gz

[Solved] Error while sending STMT_PREPARE packet. PID=29294

In the error reporting scenario, the command command of tp6 + nohup of Linux is used to execute the continuous script
error reason: the connection to the database will be disconnected for a long time

Detailed error information is as follows

[think\exception\ErrorException]                    
Error while sending STMT_PREPARE packet. PID=29294  
                                                      


PHP Fatal error:  Uncaught think\exception\ErrorException: Error while sending STMT_CLOSE packet. PID=29294 in /....../vendor/topthink/think-orm/src/db/PDOConnection.php:603
Stack trace:
#0 /....../vendor/topthink/think-orm/src/db/PDOConnection.php(603): think\initializer\Error->appError(2, 'Error while sen...', '/...', 603, Array)
#1 /....../topthink/think-orm/src/db/PDOConnection.php(1576): think\db\PDOConnection->free()
#2 /....../vendor/topthink/think-orm/src/db/Connection.php(345): think\db\PDOConnection->close()
#3 [internal function]: think\db\Connection->__destruct()
#4 {main}
thrown in /....../vendor/topthink/think-orm/src/db/PDOConnection.php on line 603

Solution:

Modify the database configuration file database.php and set it to true to enable disconnect and reconnect
 // whether to disconnect and reconnect
'break_reconnect' => true,

mac brew install mysql ‘/tmp/mysql.sock’ (2) [How to Solve]

the reason for the error is very simple: MySQL should be used instead of MySQL when starting the command server

mac brew install mysql

Install MySQL with homebrew on Mac to perfectly solve error 2002 (HY000):

Can’t connect to local MySQL server through socket ‘/tmp/mysql.Sock ‘(2) error

1. Start the command mysql server

the startup method of using MySQL command directly is wrong

This problem occurs when you directly call the MySQL command. It is said on the Internet that it is because of MySQL Caused by CNF configuration file.

the correct startup method is mysql server

➜  support-files mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
➜  support-files pwd
/opt/homebrew/opt/mysql/support-files
➜  support-files ls
mysql-log-rotate    mysql.server        mysqld_multi.server

2. my.CNF file location

my.CNF file location

➜  homebrew cd etc
➜  etc ls
bash_completion.d   ca-certificates     dump.rdb            my.cnf              [email protected]         
redis-sentinel.conf redis.conf
➜  etc pwd
/opt/homebrew/etc

3. MySQL installation location

➜  homebrew cd opt
➜  opt ls
ca-certificates jasper          libevent        libpng          lz4             [email protected]     pzstd           six
devil           jpeg            libjpeg         libtiff         mysql           protobuf        redis           zlib
icu4c           lcms2           libjpg          little-cms2     [email protected]       [email protected]   [email protected]       zstd
➜  opt cd mysql
➜  mysql ls
INSTALL_RECEIPT.json      LICENSE.router            README.router             homebrew.mxcl.mysql.plist lib                       support-files
LICENSE                   README                    bin                       homebrew.mysql.service    mysqlrouter-log-rotate
LICENSE-test              README-test               docs                      include                   share
➜  mysql pwd
/opt/homebrew/opt/mysql
➜  mysql

[Solved] MySQL Error: Can‘t find record in ‘order_form‘

Remember a mysql query problem, associated query the order table, Mysql ERROR 1032 (HY000): Can’t find record in order_form appeared, after checking the data, no problem was found.

Execute: REPAIR TABLE order_form USE_FRM The problem is solved after the repair.

PS: Before repairing, please remember to back up the table to be repaired to prevent data loss, remember! !

[Solved] Gunicorn timeout error: worker timeout

Gunicorn timeout error: worker timeout

I. Problem Description:

One morning, the developer suddenly reported a failure and the container restarted inexplicably. After checking the business container log, the worker timeout field was found

II. Analysis of error reporting reasons:

It can be seen from the error message that the worker process of gunicorn timed out, causing the process to exit and restart. Check the official website. The official website explains that the default timeout of gunicorn is 30s. If it exceeds 30s, the worker process will be killed and restarted.

III Solution:

Add: -- timeout 600 to gunicorn’s startup command to set the timeout to 600 seconds– Graceful timeout 600 indicates that the graceful timeout is 600 seconds

After the setting is completed, it is verified through kustomize inspection and re-distribution. It is found that the problem does not occur in the follow-up

[Solved] Springboot connect MySQL error: errorcode 0, state 08s01

preface

For a project that has not been maintained for a long time, you need to check some data. Re run the project and find create connection sqlexception, and the specific error messages are errorcode 0, state 08s01.

Springboot version 2.5, MySQL 8.0

Error reporting details

2021-12-18 22:47:14.834 ERROR 20196 --- [reate-940563698] com.alibaba.druid.pool.DruidDataSource   : create connection SQLException, url: jdbc:mysql://localhost:3306/renrenfast?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai, errorCode 0, state 08S01

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)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:827)
	at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:447)
	at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:237)
	at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)
	at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:156)
	at com.alibaba.druid.filter.FilterAdapter.connection_connect(FilterAdapter.java:786)
	at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150)
	at com.alibaba.druid.filter.stat.StatFilter.connection_connect(StatFilter.java:218)
	at com.alibaba.druid.filter.FilterChainImpl.connection_connect(FilterChainImpl.java:150)
	at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1572)
	at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1636)
	at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2550)
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: 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 java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
	at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
	at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
	at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:340)
	at com.mysql.cj.protocol.a.NativeAuthenticationProvider.negotiateSSLConnection(NativeAuthenticationProvider.java:777)
	at com.mysql.cj.protocol.a.NativeAuthenticationProvider.proceedHandshakeWithPluggableAuthentication(NativeAuthenticationProvider.java:486)
	at com.mysql.cj.protocol.a.NativeAuthenticationProvider.connect(NativeAuthenticationProvider.java:202)
	at com.mysql.cj.protocol.a.NativeProtocol.connect(NativeProtocol.java:1348)
	at com.mysql.cj.NativeSession.connect(NativeSession.java:163)
	at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:947)
	at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:817)
	... 11 common frames omitted
Caused by: javax.net.ssl.SSLHandshakeException: Invalid Alert message: no sufficient data
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:336)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:292)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:283)
	at java.base/sun.security.ssl.Alert$AlertMessage.<init>(Alert.java:196)
	at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:236)
	at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:185)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:171)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1408)
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1314)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:440)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:411)
	at com.mysql.cj.protocol.ExportControlled.performTlsHandshake(ExportControlled.java:316)
	at com.mysql.cj.protocol.StandardSocketFactory.performTlsHandshake(StandardSocketFactory.java:188)
	at com.mysql.cj.protocol.a.NativeSocketConnection.performTlsHandshake(NativeSocketConnection.java:99)
	at com.mysql.cj.protocol.a.NativeProtocol.negotiateSSLConnection(NativeProtocol.java:331)
	... 18 common frames omitted

Configuration details

spring:
    datasource:
        type: com.alibaba.druid.pool.DruidDataSource
        druid:
            driver-class-name: com.mysql.cj.jdbc.Driver
            url: jdbc:mysql://localhost:3306/xxx?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai

Solution:

Just add &useSSL=false

spring:
    datasource:
        type: com.alibaba.druid.pool.DruidDataSource
        druid:
            driver-class-name: com.mysql.cj.jdbc.Driver
            url: jdbc:mysql://localhost:3306/xxx?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false

Effect detection

It’s really running! It seems that

[Solved] MySQL Execute update error: error code: 1175

When using Mysql to execute update, if the primary key is not used in the where condition, the following error will be reported and the update cannot be executed.

Exception content: 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 Queries and reconnect.

Solution:
this is because MySQL runs in the safe updates mode. Modify the database security mode to allow the update or delete commands to be executed under non primary key conditions.

Execute command:

SET SQL_SAFE_UPDATES = 0;