Summary of common failures of MySQL single instance

Symptom 1: ERROR 2002 (HY000): Can't connect to local MySQL server through socket'/data/mysql/mysql.sock'

Error:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/data/mysql/mysql.sock’

problem analysis:

The above situation is generally caused by the database not being started or the database port is blocked by the firewall

Solution:

Start the database or open the database listening port on the firewall

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

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

problem analysis:

Incorrect password or no access

Solution:

1) Modify the main configuration file of my.cnf, add skip-grant-tables under [mysqld], and restart the database. The last modification password command is as follows:

mysql> use mysql;

mysql> update user set password=password("123456") where user="root";

Then delete the skip-grant-tables parameter you just added, restart the database, and log in with the new password.

2) Re-authorize, the command is as follows:

mysql> grant all on *.* to 'root'@'mysql-server' identified by '123456';

Symptom 3: The problem of slow remote connection to the database occasionally occurs when using remote connection to the database

The problem of slow remote connection to the database occasionally occurs when using remote connection to the database

problem analysis:

If the MySQL host is slow to query DNS or there are many client hosts, the connection will be slow. Since the development machine cannot connect to the external network, DNS resolution is impossible to complete, so you can understand why the connection is so slow Up.

Solution:

Modify the my.cnf main configuration file, add skip-name-resolve under [mysqld], restart the database to solve it. Note that hostname authorization can no longer be used in future authorizations.

Symptom 4: Can't open file:'xxx_forums.MYI'. (errno: 145)

Error:

Can’t open file: ‘xxx_forums.MYI’. (errno: 145)

problem analysis:

1) The server is shut down abnormally, the space where the database is located is full, or some other unknown reasons cause damage to the database table.

2) It may be that directly copying and moving database files under the operating system will cause this error due to the grouping of the files.

error.

Solution:

You can use the following two ways to repair the data table: (The first method is only suitable for independent host users)

1) Using myisamchk, MySQL comes with a tool for checking and repairing user data tables—myisamchk. Under normal circumstances, only under this can run the myisamchk command. The commonly used repair commands are: myisamchk -r data file directory/data table name.MYI;

2) Repair through phpMyAdmin. phpMyAdmin has the function of repairing the data table. After entering a table, click "Operation" and click "Repair Table" in the "Table Maintenance" below.

Note: The database must be backed up before the above two repair methods are executed. Modify the file's belonging group (only suitable for independent host users):

During the process of copying the database file, the database file is not set to be readable and writable by the account running MySQL (generally applicable to Linux and FreeBSD users).

故障现象五:ERROR 1129 (HY000): Host ‘xxx.xxx.xxx.xxx’ is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’

Error:

ERROR 1129 (HY000): Host ‘xxx.xxx.xxx.xxx’ is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’

problem analysis:

Due to the mysql database parameter: max_connect_errors (system default 10) mysqld has received a large number of (max_connect_errors) host'hostname' whose connection requests have been interrupted in the middle have exceeded 10 times, and can no longer connect to the mysqld service, the same one Blocking caused by too many interrupted database connections in a short period of time (exceeding the maximum value of max_connection_errors of the mysql database).

Solution:

1) Use the mysqladmin flush-hosts command to clear the cache, the command execution method is as follows:

mysqladmin -uroot -p -h 192.168.241.48 flush-hosts Enter password:

2) Modify the mysql configuration file, add under [mysqld] max_connect_errors=1000, and then restart MySQL.

Symptom 6: Too many connections

Client error: Too many connections

problem analysis:

The number of connections exceeds the maximum connection limit of Mysql.

Solution:

1) Increase the number of connections in the my.cnf configuration file, and then restart the MySQL service.

max_connections = 10000

2) Temporarily modify the maximum number of connections, it will not take effect after restarting. You need to modify the configuration file in my.cnf, and it will take effect next restart.

set GLOBAL max_connections=10000;

故障现象七:Warning: World-writable config file ‘/etc/my.cnf’ is ignored ERROR! MySQL is running but PID file could not be found

Error:

Warning: World-writable config file ‘/etc/my.cnf’ is ignored ERROR! MySQL is running but PID file could not be found

problem analysis:

MySQL configuration file /etc/my.cnf has incorrect permissions.

Solution:

chmod 644 /et/my.cnf

故障现象八:InnoDB: Error: page 14178 log sequence number 29455369832,InnoDB: is in the future! Current system log sequence number

Error:

InnoDB: Error: page 14178 log sequence number 29455369832

InnoDB: is in the future! Current system log sequence number 29455369832

problem analysis:

The innodb data file is damaged.

Solution:

Modify the my.cnf configuration file, add innodb_force_recovery=4 under [mysqld], back up the data file after starting the database, then remove this parameter and use the backup file to restore the data.

Guess you like

Origin blog.csdn.net/m0_47219942/article/details/108311994