How to Solve MYSQL Error: No module named MySQLdb

How to Solve MYSQL Error: No module named MySQLdb?

Solution

easy_install mysql-python (mix os)
pip install mysql-python (mix os/ python 2)
pip install mysqlclient (mix os/ python 3)
apt-get install python-mysqldb (Linux Ubuntu, ...)
cd /usr/ports/databases/py-MySQLdb && make install clean (FreeBSD)
yum install MySQL-python (Linux Fedora, CentOS ...)

[Solved] pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available

How to Solve this error?

Solution:

brew update && brew upgrade
brew uninstall --ignore-dependencies openssl; brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 281; The content of element type “sqlMapConfig” is incomplete

It can be clearly seen from the error message that this is a problem on sql

Well, in general, there are many reasons for this problem:

1. Maybe the code call method in your service is wrong (this is the lowest level error, and it is not easy to find…), directly above

Originally it was written as MMIC01.delete, which was my careless (no flash, haha)

 

2. It is also possible that one of your SQL statements is wrong (this is easier to find)

 

Compared with the previous question, this error is already executing the SQL statement, so you can put the executed SQL statement in the tool and run it, and you will know where the problem is.

[Go] Provide http service with two requests and process favicon.ico

When the http package is used, the mode processing of /this root path is registered, and the browser will automatically request favicon.ico. Be careful to handle it, otherwise there will be two requests

func main() {
    log.Println( " listen on 8080...\r\ nAccess : http://127.0.0.1:8080 " )
     // root path 
    http.HandleFunc( " / " , index)
        http.ListenAndServe( " :8080 " , nil)
}

// Home page jump 
func index(w http.ResponseWriter, r * http.Request) {
     if r.URL.RequestURI() == " /favicon.ico " {
         return
    }
}    

[PHP] Array to string conversion error when sending data in post

When using curl to pass post data, if the data field is an array, an error will be reported Array to string conversion

When calling curl_setopt_array($curl, $options);

Call curl_setopt($ch, CURLOPT_POSTFIELDS, $data)

Errors may be reported in these two places, the solution is to process the data array

http_build_query($data)

How to Solve PHP Error: no package’oniguruma’ found

When compiling and installing php, if –enable-mbstring, the mbstring extension is enabled, this regular processing library is required

 

centos

yum install http: // rpms.remirepo.net/enterprise/7/remi/x86_64 // oniguruma5-6.9.4-1.el7.remi.x86_64.rpm 
yum install http: // rpms.remirepo.net/enterprise/ 7/remi/x86_64 // oniguruma5-devel-6.9.4-1.el7.remi.x86_64.rpm

ubuntu

apt install libonig-dev

[PHP] php8 jit does not support 32-bit systems WARNING: JIT not supported by host architecture

The jit of php8 needs to be manually turned on when compiling the opcache extension

For example, my php8 source code directory is here:

/home/ubuntu/myphp/php-8.0.0alpha1/ext/opcache

carried out

./configure –enable-opcache-jit –with-php-config=/usr/local/php8/bin/php-config

There will be a warning

WARNING: JIT not supported by host architecture

 

View configuer script

 

 x86_64 only works, the others will be detected but

[GO]Solve request origin not allowed by Upgrader.CheckOrigin websocket cross-domain

Using websocket under the gin framework, this error will be reported if it is a cross-domain request

request origin not allowed by Upgrader.CheckOrigin

 

The websocket library used is “github.com/gorilla/websocket”

Need to add the following code:

    upgrader = websocket.Upgrader{
        ReadBufferSize:   1024 ,
        WriteBufferSize: 1024 ,
         // Resolve cross-domain problems 
        CheckOrigin: func(r *http.Request) bool {
             return  true
        },
    }

[MySQL] mysql 5.5 and 5.6 timestamp default default value CURRENT_TIMESTAMP problem

The behavior of TIMESTAMP in MySQL 5.5:

1. The implicit default value of the first TIMESTAMP NOT NULL field without a default value: CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

2. The implicit default value of the TIMESTAMP NOT NULL field with no default value set later: 0000-00-00 00:00:00

3. The table creation statement that does not support multiple CURRENT_TIMESTAMP default values ​​of 5.5 is similar to this:

CREATE TABLE `audit_log` (
  `id` int ( 10 ) unsigned NOT NULL AUTO_INCREMENT,
  `ent_id` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
  `rule_id` int ( 10 ) unsigned NOT NULL DEFAULT ' 0 ' ,
  rules_detail` VARCHAR `( 2048 ) the NOT NULL the DEFAULT '' the COMMENT ' rule details ' ,
  sender_email` VARCHAR `( 512 ) the NOT NULL the DEFAULT '' the COMMENT ' Sender mail review ' ,
  `receiver_email` varchar( 512 ) NOT NULL DEFAULT '' COMMENT'recipient 's mailbox ' ,
  subject` VARCHAR `( 512 ) the NOT NULL the DEFAULT '' the COMMENT ' theme ' ,
  `createtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `start_time` timestamp NOT NULL DEFAULT ' 0000-00-00 00:00:00 ' ,
  `end_time` timestamp NOT NULL DEFAULT ' 0000-00-00 00:00:00 ' ,
  status` tinyint `( 3 ) the NOT NULL the DEFAULT unsigned ' 1 ' the COMMENT ' current state (by 1, 2 rejected rejected timeout 3, 4 by timeout) ' ,
  reviewer_leader` VARCHAR `( 512 ) the NOT NULL the DEFAULT '' the COMMENT ' moderator ' ,
  PRIMARY KEY (`id`),
  KEY `idx_ent_id` (`ent_id`)
) ENGINE =InnoDB DEFAULT CHARSET=utf8 COMMENT = ' Audit log table '

The behavior of TIMESTAMP in MySQL 5.6:

Supports multiple CURRENT_TIMESTAMP default values, but does not support setting the default value to 0000-00-00 00:00:00

5.6 can be like this:

  `createtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `start_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `end_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,