Mysql Errors

Mysql Errors

Mysql Errors

1 ERROR 1044

1.1 42000

  • Error Messages

    MariaDB [mysql]>  grant select on information_schema.* to 'test'@'%';
    ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'information_schema'
    
  • the reason

    information_schema library is a view, which all objects are present in the form of view, but when the instance starts automatically loaded and created. Mariadb the library does not allow any operation.

  • solve

    For questions information_schema library, we can be authorized for its source table. Source table informat_schema library is mysql database. Test as long as the user has permission to query mysql database, you can query natural information_schema the library.

    grant select on mysql.* to 'test'@'%';
    

2 ERROR 1045

2.1 28000

2.1.1 No login rights

  • Error Messages

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
    

    In some cases, mysql logged in as root, this happens. The specific cause is unknown. I do not read the source code, or figure out this problem must give it. Egg pain.

  • Solution To solve this problem, different versions are not the same method of operation. Mainly saved by modifying mysql.user password, but different versions will be some small differences, the earlier version, as long as you can update mysql.user table, but mysql 5.6 / 5.7, in addition to manually update mysql.user, but also perform an additional operation. Here are the main operational processes:

    # Modify the parameters to achieve free login authentication database 
    will [mysqld] add the following line skip-grant-tables, save and exit the compiled file /etc/my.cnf. 
    
    # Restart mysql, different versions of the operating system command is not the same, here to CentOS 7, for example 
    systemctl restart mysqld 
    
    # manually update mysql.user.authentication_string or mysql.user.password field 
    update mysql.user set authentication_string = password ( 'your password ') the WHERE the User =' root '; 
    flush privileges; 
    
    previous versions of # 5.5, to this point, and then restart Mysql, on it. But after 5.6,5.7 but also additional operations: 
    # closed MySQL 
    systemctl STOP mysqld 
    
    # cancel dense-free access, rectify /etc/my.cnf the skip-grant-tables parameter or delete the comment. 
    
    # Build file initfile.txt, add a file follows the SQL: 
    the SET PASSWORD the FOR 'the root' @ 'localhost' = PASSWORD ( 'password'); 
    
    # start mysql --init-file specified parameters, i.e. the parameter value in the previous step compiled file name in the script command at start 
    # If you do not pass this way, encounter 
    mysqld --init-file = initfile.txt
    
    systemctl restart mysqld
    
    

2.1.2 No File Access

  • Error Messages
MySQL [ypsx_order0]> select * into outfile '/tmp/a.xls' from order0;
ERROR 1045 (28000): Access denied for user 'order_read'@'%' (using password: YES)

When data in the table by a select outfile when the data backup mode to the file system.

  • Analyze the reasons

In fact, this problem is not getting bumped. It is still a permissions problem, but if there is access to the files. Mysql.user listed in the table all the permissions a user can have, which contains a File_Priv field, if this field represents the user has permission to write the file. Only have this privilege, will it be possible next step -> write files, of course, but also to determine whether the file before writing the file path Mysql user has write permissions.

  • Solution

    update mysql.user set File_priv=’Y’ where user=’xxxx’;
    

3 ERROR 1055

  • Error Messages

    [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column
    'information_schema.PROFILING.SEQ' which is not functionally dependent on columns in GROUP BY clause;
    this is incompatible with sql_mode=only_full_group_by
    
  • Analysis
    SQL syntax and Mysql in strict accordance with the SQL 95 standard. When the polymerization operation, group by allowing non-polymeric does not contain all the select column. MySQL provides a parameter enables strict SQL 95 prepared in accordance with standard SQL, but while this parameter is flawed. Some other non-polymeric delete operation, when the java client initiates from, may cause an error: [err] 1055.
  • Solutions
    simple solution is to remove this parameter is set. The method of setting the parameters as follows:

    # Temporary adjustment 
    set @@ sql_mode = 'parameter list, separated by a comma " 
    , or 
    set global sql_mode =' parameter list, separated by commas ' 
    # permanently altered configurations to adjust the my.cnf 
    the sql_mode =' parameter list in between, different parameters comma separated '
    
  • Operation Example
    in Mysql in most of the parameters are divided into global and session level, global divided into temporary and permanent. General temporary adjustment is adjusted by the set command. Global adjustments need to be amended in the parameter file, usually /etc/my.cnf
    • Examples of temporary modifications

      mysql> set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
      Query OK, 0 rows affected (0.00 sec)
      mysql> exit
      Bye
      [root@test ~]# mysql -D
      Reading table information for completion of table and column names
      You can turn off this feature to get a quicker startup with -A
      
      Welcome to the MySQL monitor.  Commands end with ; or \g.
      Your MySQL connection id is 1814164
      Server version: 5.7.17 MySQL Community Server (GPL)
      
      Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
      
      Oracle is a registered trademark of Oracle Corporation and/or its
      affiliates. Other names may be trademarks of their respective
      owners.
      
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      
      mysql> select @@sql_mode;
      +------------------------------------------------------------------------------------------------------------------------+
      | @@sql_mode                                                                                                             |
      +------------------------------------------------------------------------------------------------------------------------+
      | STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
      +------------------------------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
      
    • Permanently modify the sample

      # Personal reformation Noriyuki before 
      Sql_mode = 'ONLY_FULL_GROUP_BY, NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION' 
      # after Noriyuki personal reformation 
      sql_mode = 'NO_AUTO_CREATE_USER, NO_ENGINE_SUBSTITUTION'
      

4 ERROR 1201

  • error code:ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log
  • Reason:

      This problem occurs because the master-slave replication has done before! Need to reset slave then change
    
  • Solve:

    reset slave;
    

5 ERROR 1292

5.1 22007

  • Error Messages

    ERROR 1292 (22007): Truncated incorrect DOUBLE value: ''
    
  • analysis

    The error is due to MySQL character field value meets the requirements of a rigorous examination, but sometimes, the result of the check is wrong. As in the following example:

    MariaDB [(none)]> update test.test set status=NULL where status=6;
    
    ERROR 1292 (22007): Truncated incorrect DOUBLE value: ''
    
    MariaDB [(none)]> desc test.test;
    +---------------------+--------------+------+-----+---------+----------------+
    | Field               | Type         | Null | Key | Default | Extra          |
    +---------------------+--------------+------+-----+---------+----------------+
    | id                  | bigint(20)   | NO   | PRI | NULL    | auto_increment |
    | status              | varchar(30)  | YES  |     | NULL    |                |
    +---------------------+--------------+------+-----+---------+----------------+
    2 rows in set (0.02 sec)
    

    From the results above point of view, status field allows empty, the default is empty. I update the value of this field empty field does not violate the constraints of the field. However, the error is bizarre what happened. Obviously there is no problem, but suggested that erroneous data.

  • View SQL_MODE

      MariaDB [(none)]> show variables like 'sql_mode';
    +---------------+-------------------------------------------------------------------------------------------+
    | Variable_name | Value                                                                                     |
    +---------------+-------------------------------------------------------------------------------------------+
    | sql_mode      | STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
    +---------------+-------------------------------------------------------------------------------------------+
    
  • Mainly to solve sql_mode in strict_trans_tables removed.

    set [global | session] variables sql_mode = 'ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
    

6 ERROR 1548

Error message:

Cannot load from mysql.proc. The table is probably corrupted.

Internal table structure does. Updates need to be upgraded:

mysql_upgrade -uroot -p

7 ERROR 1872

7.1 Error Messages

ERROR 1872 (HY000): Slave failed to initialize relay log info structure from the repository

7.2 Reasons

  1. Configuration parameters log_slave_updates. After this parameter configuration, the database needs to be generated corresponding relay logs, if not configured, is not generated, that is, dependent on log_slave_updates relay_log.
    Thus, in this case, requires the configuration parameters relay_log
  2. Master.info file information is incorrect
  3. slave information changes slave information are changed, using the reset slave. But the information in memory is not cleared. To clear the memory and configuration information, perform the reset slave all;
  4. ... Unknown.

8 ERROR 2003

  • error code:ERROR 2003 (HY000): Can't connect to MySQL server on 'ip_address' (111)
  • Reason:

9 ERROR 2013

  • error code: mysqldump: Error 2013: Lost connection to MySQL server …..
  • Reason:

    mysqldump too late to accept the mysql server sends the data over the data Server will end backlog waiting to be sent in memory, 
    this is not to wait indefinitely, and when the waiting time exceeds Server net_write_timeout (default is 60 seconds) it lost its patience, 
    mysqldump connection will be disconnected, and throw an error Got error: 2013: Lost connection. 
    
    increase net_write_timeout can solve these problems. In practice, we found that after increasing the net_write_timeout, 
    Server-side will consume more memory, and sometimes even lead to the use of the swap (not sure is not modified net_write_timeout actions). 
    Net_write_timeout mysqldump proposed changes before a large value (e.g., 1800), after mysqldump, 
    in this modification to the default value of 60.
    
  • solve:

    Set a temporary effect globally similar sql following command line command which: 
    the SET net_write_timeout on the GLOBAL = 1800;
    

Author: halberd

Created: 2019-07-18 Thu 18:18

Validate

Guess you like

Origin www.cnblogs.com/halberd-lee/p/11209123.html