Tag Archives: database

MySQL server has gone away Error [How to Solve]

Reference: solution to MySQL server has gone away error – time blog
When we use Mysql to import large file SQL, we may report the MySQL server has gone away error. The problem is the default value setting of  max_allowed_packet configuration is too small. You only need to increase the value of this item and import it again to succeed. This item is used to limit the size of the package received by the MySQL server. Therefore, if the imported file is too large, it may exceed the value set in this item, resulting in unsuccessful import! Let’s take a look at how to view and set the value of this item.

View the value of Max_allowed_packet

show global variables like 'max_allowed_packet';


+--------------------+---------+
| Variable_name      | Value   |
+--------------------+---------+
| max_allowed_packet | 4194304 |
+--------------------+---------+

You can see that the size of this item is only 4m by default. Next, set the value to 150m (1024 * 1024 * 150)

set global max_allowed_packet=157286400;

View the size again

show global variables like 'max_allowed_packet';

By increasing this value, generally speaking, importing SQL with a large amount of data should be successful again. If an error is still reported, continue to increase it. Please note that setting in the command line is only valid for the current time. After restarting the MySQL service, restore the default value, but you can modify the configuration file (you can add max_allowed_packet = 150m in the configuration file my.cnf) To achieve the purpose of permanent validity, but in fact, we do not often import such a large amount of data, so I think the current configuration can take effect through the command, and there is no need to modify the configuration file.

JMeter JDBC Error: No pool found named: ‘test‘ [How to Solve]

No pool found named

JMeter JDBC error reporting: no pool found named error information reason solution

JMeter JDBC reports an error: no pool found named

Error message

No pool found named: ‘test’, ensure Variable Name matches Variable Name of JDBC Connection Configuration

Reason

The JDBC request needs to connect to the database and needs the corresponding configuration information. If the database configuration information is not found, this error will be reported, Find the configuration information through the value filled in variable name of pool declared in JDBC connection configuration JDBC connection configuration provides the configuration information through the value filled in variable name of created pool. When there are multiple database configuration information, use variable name of pool declared in JDBC connection configuration and variable name of created pool, Ensure that the query request is not confused with the connected database

Solution

Fill the variable name of pool declared in JDBC connection configuration in the JDBC request and the variable name of created pool in the corresponding JDBC connection configuration into the same value

Canal synchronization error target column: name not matched

I. problem description

We have a usage scenario for canal:

Synchronize the same table data from multiple source ends to the same target end for unified data display.

However, it is found that after the field is deleted at source 1, the canal client logs of other sources will report an error:

Target column: name not matched
after that, the SQL operations of this table (such as insert, even if data is not inserted into the deleted field) cannot be synchronized.

II. How to avoid

In the scenario where multiple source ends are performing canal synchronization to the same target end, the drop field is prohibited.

Oracle Database AWR error: ORA-06502 [How to Solve]

Oracle database AWR report is an important tool for DBA to analyze database performance!

Recently encountered a problem and reported an error:

ERROR:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "SYS.DBMS_WORKLOAD_REPOSITORY", line 919
ORA-06512: at line 1

So, how to solve this problem?

Solution:

update WRH$_SQLTEXT set sql_text = SUBSTR(sql_text, 1, 1000);
commit;

After execution, re execute sqlplus/as SYSDBA @/ RDMBS/admin/awrrpt. SQL script successfully generates AWR report!


This sharing is over~

[Solved] Error: read ECONNRESET at TCP.onStreamRead Cannot enqueue Query after fatal error

Error analysis

This error often occurs when I use node to connect to MySQL. I wonder if it is because I do not close the connection every time I query the database after creating a MySQL connection, so the database is always connected and does not respond for a long time, resulting in the following error
error1:

error2:

 

Solution:

error1:

const mysql = require('mysql');
const connInfo = require('./config');

function queryMysql(sql, callback){
    const conn = mysql.createConnection(connInfo)
    conn.query(sql, (err, result)=>{
        if(err){
            console.log(err);
        }else {
            callback(result)
        }
        conn.end(err => {
            if(err){
                console.log(err)
            }
        })
    })
}

module.exports = queryMysql;

Error2:
We only need to configure useConnectionPooling true when instantiating SessionStore for example:

var sessionStore = new SessionStore({
    host: 'localhost' ,
    port: 3306 ,
    user: 'root' ,
    password: 'root' ,
    database: 'session' ,
    useConnectionPooling: true 
});

[Solved] WordPress Upgrade PHP 5.6 to 7.x Fatal error: Uncaught Error: Call to undefined function mysql_connect()

Error reporting when upgrading PHP version 5.6 to 7. X under WordPress (resolved)

Cause of event:

When using WordPress, the theme needs to be upgraded. The PHP version required for viewing the theme is 7.1+

When the website is not backed up, the PHP version is changed to 7.2, which directly leads to the website error

Fatal error: Uncaught Error: Call to undefined function mysql_ connect()

Check many online tutorials, which are MySQL in wp-db.php_Change connect() to mysqli_Connect(), no result

At first, I thought that the database reported an error, checked the database in detail, wrote checkdb.php, locally connected to the database, and checked that the database server was running well

Solution:

Set define ('wp_use_ext_mysql ', true) in wp-config.php delete

error explanation:

define('WP_USE_EXT_MYSQL',true);

define(‘WP_USE_EXT_MYSQL’, true); Force WP to use MySQL by default instead of MySQL Li
so please delete this line and the problem should be solved.

Otherwise, you can check nd in the PHP 7 configuration_Mysqli extension, and disable mysqli extension – > Select the PHP version.

[Solved] PostgreSQL enumeration type usage error: operator does not exist error handling

//Creating Enumeration Classes
CREATE TYPE USER_ROLE AS ENUM ('MALE', 'FEMALE');
//Add conversion rules
CREATE CAST (VARCHAR AS USER_ROLE) WITH INOUT AS IMPLICIT;
//Create table, add fields of enumeration type
create table sys_user
(
    row_id      bigserial          not null
        constraint sys_user_pkey primary key,
    create_time timestamp(6),
    update_time timestamp(6),
    del_flag    smallint default 0 not null,
    role        USER_ROLE      not null,
    user_name   varchar(200)       not null
);

Because the conversion rule is added, you can directly use the varchar type string as the judgment condition query in pgadmin, but if you use mybatis to query the database, the error operator does not exist will be reported

select * from sys_user where del_flag = 0 and role = 'MALE'

Solution: convert varchar type to enumeration type and compare

Method 1
select * from sys_user where del_flag = 0 and role = cast(#{role} as user_role);
Method 2
select * from sys_user where del_flag = 0 and role = #{role}::user_role;

Error querying database.Cause:java.sql.SQLSyntaxErrorException:ORA-00911:invalid character

This problem is well positioned. At first glance, it is the problem of parameter transmission. Through this error report, the first thing to consider is the like part of the query condition.

  The main idea of this problem is 1. Special characters are passed, such as’ ‘  

                                  2. See if the like query uses #{} or ${}

                                  3. Is there a problem with where involving parameter statements

 

 

MySQL — initialize failed to generate temporary password in error log after initialization

1. Version

1) Operating system version

cat /proc/version
Linux version 3.10.0-957.1.3.el7.x86_ 64 ( [email protected] ) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 29 14:49:43 UTC 2018

2) Database version

mysql –version
mysql   Ver 8.0.13 for linux-glibc2.12 on x86_ 64 (MySQL Community Server – GPL)

2. Problem description

   In versions after 5.7.6, MySQL will be generated in the error log after initialization (specify the — initialize parameter for initialization)   [email protected] Temporary password for the user. However, in this deployment, after starting mysql, it was found that no temporary password was generated in the errorlog

3. Problem solving

Later, it was found that the file in/etc/my.cnf was accidentally deleted   log_ The error parameter is commented out, so that when initializing the instance, all information is sent to the standard output. When MySQL is started, it is based on the log_ The default value of error generates a log_ error