Several common Mysql errors and solutions:
1. Problem: mysql DNS Reverse Solution: skip-name-resolve
The error log has a similar warning:
Click (here) to fold or open
- 120119 16:26:04 [Warning] IP address '192. 168.1.10 'cocould not be resolved: Name or service not known
- 120119 16:26:04 [Warning] IP address '192. 168.1.14 'cocould not be resolved: Name or service not known
- 120119 16:26:04 [Warning] IP address '192. 168.1.17 'cocould not be resolved: Name or service not known
A large number of connections similar to the following are found through show processlist:
Click (here) to fold or open
- | 592 | unauthenticated user | 192.168.1.10: 35320 | NULL | Connect | login | NULL |
- | 593 | unauthenticated user | 192.168.1.14: 35321 | NULL | Connect | login | NULL |
- | 594 | unauthenticated user | 192.168.1.17: 35322 | NULL | Connect | login | NULL |
The function of the skip-name-resolve parameter is as follows: no reverse ip resolution is performed and no domain name is obtained. This can speed up the response time of the database. Modify the configuration file and restart it:
Click (here) to fold or open
- [Mysqld]
- Skip-name-resolve
2. Error Log: Error: Can't create a new thread (errno 12)
Due to database server problems, a new thread cannot be created for database operations. Generally, there are three reasons:
1) MySQL threads are too open.
2) The server system memory overflows.
3) Environmental software damage or system damage. Problem Solving]
Click (here) to fold or open
- 1) enter the user table in the mysql database of phpmyadmin, edit the database user, and modify the value of max_connections. Change it to a smaller value.
- 2) contact the server administrator to check whether the server memory and system are normal. If the server memory is insufficient, check which processes consume the server memory, at the same time, consider whether to increase the server memory to improve the load capacity of the entire system.
- 3) change the mysql version to a stable version.
- 4) Optimize the SQL of website programs, etc.
3. Operation ERROR: Error 1010 (HY000): ERROR dropping database
Click (here) to fold or open
- Mysql> drop database xjtrace;
- ERROR 1010 (HY000): Error dropping database (can't rmdir './xjtrace/
This prompt appears when you delete a database. The reason is that the database contains files that you put in, for example *. txt file or *. SQL file, etc., as long as the file is deleted and executed.
Click (here) to fold or open
- Mysql> drop database xjtrace;
- Query OK, 0 rows affected (0.00 sec)
Delete it !! 4. export data quickly, but it is slow to import data to the new database: SQL statements exported from MySQL may be very slow during import, and only 4 million records have been imported, it took nearly two hours. Using a few parameters properly during export can greatly speed up the import. -E uses the multiline INSERT syntax that includes several VALUES lists;
-- Max_allowed_packet = maximum size of the cache for communications between the XXX client/server;
-- Net_buffer_length = XXX TCP/IP and socket communication buffer size. Create a line with the length up to net_buffer_length. Note: max_allowed_packet and net_buffer_length cannot be greater than the configured value of the target database. Otherwise, an error may occur. First, determine the parameter value of the target database.
Click (here) to fold or open
- Mysql> show variables like 'max _ allowed_packet ';
- + -------------------- + --------- +
- | Variable_name | Value |
- + -------------------- + --------- +
- | Max_allowed_packet| 1048576 |
- + -------------------- + --------- +
- 1 row in set (0.00 sec)
- Mysql> show variables like 'net _ buffer_length ';
- + ----------------- + ------- +
- | Variable_name | Value |
- + ----------------- + ------- +
- | Net_buffer_length | 16384 |
- + ----------------- + ------- +
- 1 row in set (0.00 sec)
Write the mysqldump Command Based on the parameter value, for example:
Mysql> mysqldump-uroot-p database name-e -- max_allowed_packet = 1048576-net_buffer_length = 16384> SQL file example:
Click (here) to fold or open
- Mysql> mysqldump-uroot-p xjtrace-e -- max_allowed_packet = 1048576 -- net_buffer_length = 16384> xjtrace_data _ 'date + % F'. SQL
The SQL statements that can be imported in the past two hours can be completed in dozens of seconds.
This article is from the "vcdog's blog" blog, please be sure to keep this source http://255361.blog.51cto.com/245361/1050467