10 Common Errors and Solutions of MySQL

Source: Internet
Author: User
Keywords mysql errors mysql errors list mysql errors and solutions
1. Can't connect to MySQL server on'localhost'(10061)?

Cannot connect to mysql on localhost? Analysis: This shows that the "localhost" computer exists, but no MySQL service is provided on this machine. ? Need to start the MySQL service on this machine, if the machine load is too high and the corresponding request will also generate this error. Solution: Since it is not started, go to start the mysql of this machine. If the startup is unsuccessful, it is mostly because of a problem with your my.ini configuration. Just reconfigure it. If you think the mysql load is abnormal, you can go to the mysql/bin directory and execute mysqladmin-uroot -p123 processlist to view the current process of mysql.

2. Unknown MySQL ServerHost'localhosadst' (11001)

Unknown MySQL server localhosadst? Analysis: The server localhosasdst does not exist. Or can't connect at all? Solution: Double check the ./config.inc.php under your forum to find $dbhost and reset to the correct mysql server address.

3. Access denied for user:'roota@localhost' (Using password: YES)

The user roota was denied access to localhost (not allowed to pass)? Analysis: The general database user name and password caused by this error is incorrect relative to the mysql server? Solution: Carefully check the following./config.inc.php in your forum. After verification, $dbpw can be reset and saved.

4. Access denied for user:'red@localhost' to database'newbbs'?


The user red does not have permission to operate the database newbbs on the localhost server? Analysis: This prompt is different from the third question. That was blocked when connecting to the database, and this error was caused when the database was operated. For example, in selectupdate and so on. This is because the user does not have the corresponding authority to operate the database. For example, select this operation records in mysql.user.Select_priv Y can operate N can not operate. Solution: If it is its own independent host, then update the corresponding user record of mysql.user, for example, the user to be updated here is red. Or directly modify ./config.inc.php to configure it with a user who has permission to operate the database? Or update the authorization grantall privileges on dbname.* to'user'@'localhost' identified by'password'? Tip: After updating the records in the mysql library, you must restart the mysql server for the update to take effect? FLUSH PRIVILEGES;



5, No Database Selected

No database was selected? Analysis: There are two reasons for this? The $dbname setting in config.inc.php is incorrect. As a result, the database does not exist at all, so when $db->select_db($dbname); returns false? It is the same as the fourth question above. The database user does not have select permission, which will also cause such an error. When you find that there is nothing wrong with the configuration of config.inc.php, but it still prompts this error, that must be the case. ?Solution: Give the right medicine? Open config.inc.php and find $dbname to verify the reconfiguration and save it? Same solution as the fourth problem


6, Can't open file:'xxx_forums.MYI'. (errno: 145)

Can't open xxx_forums.MYI? Problem analysis:? This situation is caused by the inability to open cdb_forums.MYI. The possible reasons for this situation are:? 1. The server is shut down abnormally, the database is full, or some other Unknown reasons caused damage to the database table. 2. Directly copying and moving the database file under the unix-like operating system will cause this error because of the problem of the file's group. ?Solution: ?1, repair the data table? 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 dedicated user data table check and repair Tool-myisamchk. Change the current directory to MySQL/bin, under normal circumstances only under this can run myisamchk command. 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 certain table, click "operation", below Click "Repair Table" in "Table Maintenance". ?Note: Be sure to back up the database before performing the above two repair methods. ?2. Modify the file's group (only for independent host users)? 1) 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).


7, Table'test.xxx_sessions' doesn't exist

The xxxxx table does not exist? Analysis: The table was not found when the sql statement was executed, such as: SELECT * FROMxxx_members WHERE uid='XX'. If the table xxx_members does not exist in the $dbname library, then this error will be prompted. It can be divided into the following three situations to discuss:? Modify the program file when installing the plug-in or hack, and forget to upgrade the database accordingly. ? Incomplete backup is used in the background, and the data is not imported into the database of the forum where the corresponding version has been installed. ?Solution: The same symptomatic treatment, different reasons for different treatment methods. ? Carefully compare the installation instructions provided by the author of the plug-in and make up for the missing operations on the database. If the problem still cannot be solved, then the usability of the plug-in should be suspected. Consult the plugin author or uninstall it. Don't wear Zhang Guanli Dai, wear shoes as big as your feet. In short, the program files and the database can be matched.


8, Unknown column'column_name' in'field list'

Unknown field name column_name? Analysis: When the sql statement is executed, the field name that is not in the specified table appears, this error will occur. The specific causes can be divided into the following two? When installing the plug-in or hack, the program file was modified, and I forgot to upgrade the database accordingly. The program file and the database are not matched. For example, the database configuration of d2.5 is used for the program of d4.1. This error will definitely occur. ?Solution: The cause is the same as 1 and 3 in problem eight, so the solution is the same.


9, You have an error in yourSQL syntax

There is a grammatical error in your sql? Analysis: There is no sql grammatical error in the standard program of the forum. So there are generally two reasons for this error? Install plug-ins or modify the program without permission. Different database version database export and import, such as MySQL4.1 data in the export statement contains functions that MySQL4.0 does not, such as character set settings, then if you import these sql into MySQL4.0 SQL syntax error occurred. Solution: Check carefully to see where the error is and fix it. If it doesn't work, replace the error program with the standard program. ?Be careful when backing up the database. If you don't plan to pour it into other versions of mysql, you don't need special consideration, otherwise you need special settings. Using DZ4.1 background data backup, you can follow the prompts to set the desired format. Independent hosts can also export it to mysql4.0 format when they are everywhere. ?mysqldump -uroot -p--default-character-set=latin1 --set-charset=gbk --skip-opt databse >test.sql

10, Duplicate entry'xxx' for key 1

Insert xxx to make index 1 repeat? Analysis: If the index is primaryunique, then the field corresponding to the data in the data table must guarantee the uniqueness of each record. Otherwise, this error will occur. ? Generally occurs when writing to the database, for example, Discuz! 4.1 Forum program requires that all member usernames username must be unique, that is, the index of username is unique, then if forced to insert an existing username record into the cdb_members table This error will be sent, or the username of a record will be updated to an existing username. ? It may cause this error when changing the table structure. For example, the index type of cdb_members.username in the database of Discuz! 4.0 forum is index. At this time, records with the same username are allowed to exist. When upgrading to 4.1, it is necessary to change the index of username from original index to unique. If there is a record with the same username in cdb_members then this error will be raised. When exporting data, sometimes the same record is repeatedly exported due to some reasons (the author is not yet clear), then this error is unavoidable when this backup data is imported. ? Modified the value of auto_increment so that "Next Autoindex" is an existing record? Solution: Two ideas, one is to destroy the unique index. The second is to eliminate duplicate data records, and only keep one. Obviously the first idea is undesirable. Then according to the two ideas, we come to the following solutions, corresponding to the above i iiiii? Omit? Follow the information in the error prompt to delete the duplicate records in the database, and only keep one. After that, proceed with the upgrade operation. ? The probability of this happening is very small, you can use a text editor to open the backup document to find duplicate information. Remove the excess and just keep one. Query the record with the largest auto_increment in the table, and set auto_incerment to be one greater than it. ?PS: reply table "table name", can temporarily solve the problem.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.