Tag Archives: mysql

[How to Solve] Content with element type ‘mapper’ must match

Today, in the mapper. XML file, I mistakenly annotated it with /* * code description */ and then reported this error
the specific exception is as follows

Caused by: org.xml.sax.SAXParseException; lineNumber: 134; columnNumber: 10, The element type "mapper" must match "(cache-ref|cache|resultMap*|parameterMap*|sql*|insert*|update*|delete*|select*)+"。

error code 

   /** Public conditions */
    <sql id="commonIfWhere">
        <if test='params.projectId != null and params.projectId != ""'>
            and project_id = #{params.projectId}
        </if>
        <if test='params.id!= null and params.id != ""'>
            and id = #{params.id}
        </if>
    </sql>

after correction

   <!-- Public conditions -->
    <sql id="commonIfWhere">
        <if test='params.projectId != null and params.projectId != ""'>
            and project_id = #{params.projectId}
        </if>
        <if test='params.id!= null and params.id != ""'>
            and id = #{params.id}
        </if>
    </sql>

The problem was solved smoothly

[Two Methods] Ora-00904: invalid group by error identifier

I believe many students encounter the problem of invalid prompt identifier when using group by. Don’t worry, let’s summarize the common solutions to this problem:

Example: take the information of the youngest employee in each department
my SQL statement is as follows:

select name,min(age),(select deptname from dept d where d.deptid=uif.deptid)deptname from userinfo uif group by name,deptname

When you click execute, the system prompts:

ORA-00904:"deptname":Identifier is invalid

Error reason: the field after group by cannot be an alias (if you want to use an alias, you need to nest it at one level)

Solution 1:

--goup by The department name (alias: deptname ) is directly used in the deptid field of the employee information table
select name,min(age),(select deptname from dept d where d.deptid=uif.deptid)deptname from userinfo uif group by uif.name,uif.deptid

Solution 2:

--Grouping after one level of nesting
select us.name,min(us.age),us.deptname from (select name,age,(select deptname from dept d where d.deptid=uif.deptid)deptname from userinfo uif)us
group by us.name,us.deptname

How about this time?If you have any questions, please leave a message to study together~

MySQL: How to Turn on Functions

I want to customize the function today, but the mysql console reports an error
This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you might want to use the less safe log_bin_trust_function_creators variable)
It means I don’t have the function function enabled

show variables like '%func%';		

Here I have turned on the function function as on

setting parameters to turn on the function function

set global log_bin_trust_function_creators=1;

Ubuntu ODBC MySQL 8 OPTION NOT Work [How to Solve]

Error due to FreeSWITCH using ODBC requirements
If you are using mysql, make sure you are using MYODBC 3.51.18 or higher and enable FLAG_MULTI_STATEMENTS

# vim /etc/odbc.ini
[freeswitch]
Driver = MySQL
SERVER = localhost
PORT = 3306
DATABASE = myDatabase
OPTION = 67108864

Note: option = 67108864   Start SQL batch, freeswitch   ODBC mode must be on

ODBC does not configure SQL preprocessing, resulting in an error when executing multiple SQL statements at the same time

ubuntu20.04

Download and install ODBC driver from MySQL website

Note that the version option of 8x is invalid after setting,

Solution demotion

mysql-connector-odbc-5.3.14-linux-ubuntu19.10-x86-64bit.tar.gz

Verification supports preprocessing methods, which are not described here for ODBC configuration

isql -v freeswitch

delete from sip_ registrations where sub_ host is null and hostname=’VM-0-13-ubuntu’ and network_ ip like ‘%’ and network_ port like ‘%’ and sip_ u

Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe

mysql: [ Warning] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe:   ignoring option  ‘–
Before opening MySQL, it was normal. After entering the password today, it has been flashing back. The warning is as follows:

mysql: [ Warning] C:\Program Files\MySQL\MySQL Server  8.0\bin\mysql.exe:   ignoring   option  ‘– no-beep’   due   to   invalid   value  ‘’.**

terms of settlement:

Open the above path (my computer is like this, the default path, if your path is not the same, it is recommended to find the installation path), find my.ini file, it is recommended to save a copy before changing to prevent modification errors. Open it in Notepad and find the following statement:

Delete the “=” in the red underlined statement and click save.

Reopen the MySQL execution box. Generally speaking, 80% of the problem is solved successfully. However, if you still flash back, right-click to find the folder where MySQL is located and enter the. EXE file from the folder chart. I hope these will help you.

Sqlog connect to MySQL 8.0.24 remote server, error: 2058 solution

Write in front:

  I love technology, love sharing, love life, I always believe: technology is open source, knowledge is shared!   Most of the content in the blog is original. It is my daily learning record and summary, which is convenient for me to review later. Of course, I hope I can share my knowledge. The current content is almost basic knowledge and technology introduction, if you think it’s OK, you might as well pay attention to it, we make progress together!   In addition to sharing blog, I also like to read books, write some daily essays and share my mood. If you are interested, you can also pay attention!   WeChat official account: Mr.
, proud proud deer.  

Sqlog connect Linux remote server to display 2058 error

 
The reason for this error is that the default authentication plug-in in mysql8.0 has been changed   mysql_ navtive_ Password, now it’s caching_ sha2_ password

  resolvent:

If you are a local connection, enter the following command on the MySQL command line

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

If you are a remote connection server mysql, then enter the following command. First of all, you must have% in the user table of your database and the host field

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

Change the password to your MySQL password

The host field represents the address where you can access the database, localhost represents local access, and% represents remote access

Connection successful:

Springboot uses druid to log in MySQL. An error occurred: access denied: errorcode 1045, state 28000

In case of an error, first of all, check whether the database can be accessed correctly through MySQL instructions:
it is found that the database can be accessed normally

later, when I observed my configuration, I found that my password was all digital. There would be a little problem with all digital passwords in the YML file, so I need to add ‘single quotation mark to correctly identify them. The correct configuration is as follows:

spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/mall?useUnicode=true&characterEncoding=utf8&useOldAliasMetadataBehavior=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=UTC
    username: root
    password: '123456'
    driver-class-name: com.mysql.cj.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource

[Solved] com.alibaba.druid.pool.DruidDataSource – create connecti

A service deployed in the server docker reported the following error when connecting to the database:

I have searched a lot of information on the Internet, but I can’t solve it by trying various ways,
ERROR com.alibaba.druid.pool.DruidDataSource - create connection SQLException, url: jdbc:mysql://10.10.20.16:3306/acs?&useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&serverTimezone=Asia/Kolkata, 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.

The specific error information is as follows:

ERROR com.alibaba.druid.pool.DruidDataSource – create connection SQLException, url: jdbc:mysql ://10.10.20.16:3306/acs?& amp; useUnicode=true& characterEncoding=UTF-8& zeroDateTimeBehavior=convertToNull& allowMultiQueries=true& serverTimezone=Asia/Kolkata, 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.

Cause of error:

It may be due to the different versions of JDK. This error message is probably caused by the SSL protocol of MySQL

solution: I tried to remove SSLv3 from java.security in jdk-8 on my local machine and restart the service, but I still couldn’t solve it
finally, add this to the MySQL connection string in the service configuration; Usessl = false, that is, disable SSL, problem solved

ERROR 1045 (28000): Access denied for user’ODBC’@localhost (using password: NO)209150;’211503;’

Sometimes, due to carelessly forgetting the password or installation errors, the following errors will be reported when running MySQL:

ERROR 1045 (28000): Access denied for user ‘ODBC’@‘localhost’ (using
password: NO)

According to the solution on the Internet:
or modify the configuration file my.ini

skip-grant-tables

To skip password verification
or: edit my.cnf,

But the above is useless. After trying to spit blood, I found that I could not even start MySQL service by modifying the configuration file, but so on….. Isn’t there a landing<
after clicking , I found that I can change the password directly here

change the password to my own setting, I set it to 123456, log in again, success