Tag Archives: mysql

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)   root@localhost 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

ERROR 1820 (HY000): Unknown error 1820,ERROR 1046 (3D000):

After MySQL logs in, an error occurs when executing the statement:

root@localhost 09:05:  [(none)]> use mysql;
ERROR 1820 (HY000): Unknown error 1820
root@localhost 09:05:  [(none)]> show tables;
ERROR 1046 (3D000): 

terms of settlement:

root@localhost 09:06:   [(none)]> Set password = password (‘password ‘);

  I hope it will help you

[Solved] MYSQL Error: unknown error 1130, unknown error 1045

When using Navicat to link mysql, the following error is reported:

Solution:

Log in to MySQL on the server and enter use MySQL:

root@localhost 09:07:  [mysql]> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.07 sec)
root@localhost 09:12:  [mysql]> flush privileges;
Query OK, 0 rows affected (0.02 sec)

Then, using the Navicat link again, the following appears:

Solution:

GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘yourpassword’ WITH GRANT OPTION

root@localhost 09:13:  [mysql]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.02 sec)

root@localhost 09:14:  [mysql]> flush privileges;
Query OK, 0 rows affected (0.02 sec)

To sum up: this kind of error is probably caused by the permissions set by the root user in MySQL in the database

[Solved Perfectly] MySQL ERROR 1064 (42000): You have an error in your SQL syntax;

The perfect solution to error 1064

1064 error code appears when setting the root account password in MySQL

at first, I thought the user name and password could not be the same, so I changed it to 123456

and found it still couldn’t.

Solution

Enter as follows:

alter user 'root'@localhost identified by '123456';

By ‘…’ is followed by the new password.

[Solved] Navicat connection error 1251 compatibility with docker MySQL

# Modify the encryption rules
(1) ALTER USER ‘root’@’%’ IDENTIFIED BY ‘password’ PASSWORD EXPIRE NEVER;
# Update the user’s password
(2) ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘password’;
# Refresh permissions
(3)FLUSH PRIVILEGES;
reconnect the Navicat will solve the problem.

Sqlyog connection error: error number 2058

Sqlyog connection error: error number 2058

MySQL version: 8.0.21sqlyog configuration new connection error, error number 2058

resolvent

Open CMD as an administrator and log in to your MySQL database: MySQL - U root - P execute this statement according to your situation: alter user 'root' @'localhost 'identified with MySQL_ native_ Password by 'password to modify' after running successfully, reconfigure the connection to sqlyog to succeed

Error querying database.Cause: java.sql.SQLException: Error setting driver on UnpooledDataSource.

Record the problems encountered in the learning process of Java mybatis framework

1. An exception occurred while building the first mybatis project:

Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: 

Error querying database. Cause: java.sql.SQLException: Error setting driver on UnpooledDataSource. 
Cause: java.lang.ClassNotFoundException: Cannot find class: com.mysql.cj.jdbc.Driver

Solution: the MySQL connector Java driver version is used incorrectly
I use MySQL version 8.0.22

import the driver of version 5.1.23, and the dependency declared in pom.xml file is

<dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.23</version>
    </dependency>

The two versions do not correspond, so the driver error cannot be found.
the solution is to download the driver of version relative to, that is, the driver of version 8.0.22. The official website address is version 8.0.22
and then change the dependency in the POM file to:

<!--MySQL-->
<dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>8.0.22</version>
    </dependency>

Another point is that the POM file should include not only driver dependencies, but also mybatis dependencies

<!--mybatis-->
<dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>3.4.5</version>
    </dependency>

Mysql8.02/ubuntu 20 ERROR 1449 (HY000) [How to Solve]

Just after installing MySQL through apt install MySQL server, I encountered a pit. After checking for a long time, I finally found the answer. Thank you, netizens.

mysql> show databases;
ERROR 1449 (HY000): The user specified as a definer ('mysql.infoschema'@'localhost') does not exist

If you enter mysql, you will report an error. I don’t know why. Confused B

mysql> create user ' mysql.infoschema '@'% 'identified by' password ';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on *.* to 'mysql.infoschema'@'%';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

Mybatis Error setting non null for parameter #15 with JdbcType null Could not set parameters for

Caused by: org.apache.ibatis.type.TypeException: Error setting non null for parameter #15 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (15 > number of parameters, which is 14).
	at org.apache.ibatis.type.BaseTypeHandler.setParameter(BaseTypeHandler.java:71)
	at com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler.setParameters(MybatisDefaultParameterHandler.java:227)
	... 88 more
Caused by: java.sql.SQLException: Parameter index out of range (15 > number of parameters, which is 14).

If a comment SQL fragment exists in the SQL code, the #{} parameter cannot be used in the comment SQL fragment. As follows:

        on t1.dealer_code = t4.dealer_code
        -- left join (
        --     select
        --         ads_code
        --        ,sum(case when car like '%MM%' or model = 'MM' then ss_num else 0 end) as ws_MM_num
        --     from abc_assss_ss
        --     where seq = 1 and count_date between '2021-04-01' and '2021-06-30'
        --     group by
        --         dealer_code
        --     )t2
        -- on t1.asd_code = t2.ads_code
        )
        select
      ~~~
      If you replace the between and with the parameter between #{start_time} and #{end_time}, it will report this error, hope it can solve your problem

[Solved] Vue Error: Duplicate keys detected: ‘74004’. This may cause an update error

Problems and Solutions

This may cause an update error

This error indicates that in your V-for loop, key   The value may be duplicate.

Duplicate key will cause rendering errors.

The reason for the error is that I didn’t add the key attribute at the beginning. The error code fragment is as follows:

<template>
    <vue-aplayer
            :audio="audio"
            :lrc-type="3"
            :fixed='fixed'
            :autoplay='autoplay'
            :order='order'
            :volume='volume'
            :theme='theme'
            :listFolded='listFolded '
    />
</template>


No more errors will be reported after adding key

<template>
    <vue-aplayer
            :audio="audio"
            :lrc-type="3"
            :fixed='fixed'
            :autoplay='autoplay'
            :order='order'
            :volume='volume'
            :theme='theme'
            :listFolded='listFolded '
            :key="audio.name"
    />
</template>


Note: audio attribute is the list I want to traverse, and name is the primary key in my list, so here I take audio. Name as the value of key ,   key must be unique.

Official description

key

Expectation: the special attributes of number | string key are mainly used in Vue’s virtual DOM algorithm to identify vnodes when comparing old and new nodes. If you do not use keys, Vue will use an algorithm that minimizes dynamic elements and tries to modify/reuse elements of the same type in place as much as possible. When using a key, it rearranges the order of elements based on the change of the key, and removes elements that do not exist in the key. Child elements with the same parent element must have a unique key. Duplicate keys can cause rendering errors. The most common use case is the combination of V-for :

<ul>
  <li v-for="item in items" :key="item.id">...</li>
</ul>


It can also be used to force replacement of elements/components rather than reuse it. It may be useful when you encounter the following scenarios:

Completely trigger the life cycle hook of the component to trigger the transition, for example:

<transition>
  <span :key="text">{{ text }}</span>
</transition>


When text changes, <span> is always replaced rather than modified, so a transition is triggered.

Solve MySQL installation error: initializing database prompts an error when installing mysql

Solve MySQL installation error: initializing database prompts an error when installing mysql

when we install MySQL database, we report an error in initializing database because MySQL has not been completely uninstalled before. We can solve it according to the following methods:

1. First stop the original MySQL service

-Right click my computer
– select “management”
– click “service”
– find MySQL
– right click to close the service

2. Enter the control panel to uninstall mysql

in the panel, right-click Mysql to uninstall, and then follow the steps prompted to uninstall

3. Go to MySQL installation directory and delete relevant files

generally, the database is on Disk C by default. Open it in the file browser, and then check the “hidden items” to open the following three files

– Program Files
– Program Files (x64)
– ProgramData

delete the MySQL directory under these three folders

4. Clean the registry and completely delete the MySQL service

Press and hold the windows key + r on the keyboard to open the command line, enter regedit to enter the registry
and find it in turn:

HKEY_ LOCAL_ MACHINE——SYSTEM——ControlSet001——services——eventlog——Application——MySQL

right click the MYSQL to delete it. If there are still the following directories:

HKEY_ LOCAL_ MACHINE——SYSTEM——ControlSet002——services——eventlog——Application——MySQL

you can also right-click to delete. If not, it will be ignored

5. Restart the system

phpstudy Error while setting value ‘STRICT_TRANS_TABLES, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION

Today, I came to phpstudy. I found that MySQL could not be opened and reported this error. After a round of search, I solved the problem
Modify mysql.ini

sql_ mode =‘STRICT_ TRANS_ TABLES,NO_ ZERO_ IN_ DATE,NO_ ZERO_ DATE,ERROR_ F
OR_ DIVISION_ BY_ ZERO,NO_ AUTO_ CREATE_ USER,NO_ ENGINE_ ‘
I solved it like this. It depends on whether you can do it or not

Others have provided the following solutions
1. Phpstudy upgrade, SQL_ Mode is followed by more spaces. Just delete the spaces

2、 Directly annotate SQL_ Mode line content( After I do this, MySQL starts and then stops, and goes back and forth ε=( ´ ο`*))) Alas)

3、 Remove SQL_ No in mode_ AUTO_ CREATE_ USER

4、 SQL_ mode = NO_ AUTO_ CREATE_ USER,NO_ ENGING_ SUBSTITUTION

All the above are modified in mysql.ini