MySQL general registration insert optimization ., Mysql registration insert Optimization

Source: Internet
Author: User

MySQL general registration insert optimization ., Mysql registration insert Optimization

The common practice is:

The user registers with the mobile phone number. By default, the user table is queried Based on the mobile phone number to see if the mobile phone number is available. If yes, the system prompts that the user has registered. Otherwise, you can register and insert the database. In fact, the normal registration process is two Database Operations (query, insert );

Optimization practices:

Set the mobile phone number to a unique index. Directly perform the insert operation. The Error Reporting Mechanism of MySQL is used here. If the inserted mobile phone number is the same as that in the database, you can call the MySQL method mysql_errno () to see that it is 1062; 1062 indicates that the inserted mobile phone number database already exists. Insertion failed. In this way, you can know. Whether the user already exists in the database. Only one insert operation is performed;

Appendix mysql_errno common error code explanation

1005: Table creation failed 1006: database creation failed 1007: database already exists, database creation failed 1008: Database not found, database deletion failed 1009: database files cannot be deleted, resulting in database deletion failure 1010: failed to delete the database because the data directory cannot be deleted. 1011: failed to delete the database file. 1012: unable to read the records in the system table. 1016: Unable to open the file. 1020: the record has been modified by another user. 1021: insufficient space on the hard disk. please increase the available space of the hard disk. 1022: duplicate keyword. failed to change the record. 1023: disabled. 1024: File Read error. 1025: name changed. Error 1026: file write error 1032: the record does not exist 1036: The data table is read-only and cannot be modified 1037: The system memory is insufficient. Please restart the database or restart the server 1038: the memory used for sorting is insufficient, increase the sorting buffer by 1040: the maximum number of connections to the database. Increase the number of available connections to the database by 1041: The system memory is less than 1042: Invalid host name 1043: Invalid connection 1044: the current user does not have the permission to access the database 1045: cannot connect to the database, username or password error 1040: Maximum number of connections 1048: The field cannot be blank 1049: the database does not exist 1050: The data table already exists 1051: data table does not exist 1054: field does not exist 1065: Invalid SQL statement, SQL statement is empty 1081: cannot establish Socket connection 1114: The data table is full, cannot accommodate any records 1116: too many open data tables 1129: database exception. Please restart database 1130: database connection failed, no database connection permission 1133: database user does not exist 1141: current user does not have access to database 1142: current user does not have access to data table 1143: the current user is not authorized to access the field 1146 in the data table: the data table does not exist 1147: the user's access permission to the data table is not defined 1149: SQL statement syntax error 1158: network error, read error, please check network connection status 1159: network error, read timeout, please check network connection status 1160: network error, write error, please check network connection Status 1161: network error, write timeout, check network connection status 1062: The field value is repeated and the Database Import fails.

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.