Resolves error 1005 solution when creating foreign keys in Mysql _mysql

Source: Internet
Author: User

When you create a foreign key in MySQL, you are prompted with an error, but only a very simple message: Error 1005 (HY000): Can ' t create table ' db_qxztc.qx_userssssnew ' (errno:150). Does not solve the problem at all.

To see the detailed prompts for the error, you can use the command: (found in the MySQL manual search "errno 150")

Show ENGINE INNODB STATUS; For databases that use InnoDB storage

There is a set of "LATEST FOREIGN KEY Errors" in the information that has a detailed description of the recent error and a workaround.
Such as:
111211 12:49:34 Error in FOREIGN key constraint of table db_qxztc/qx_userssssnew
:
Foreign key (' Ssssid ') references ' qx_ssss ' (' Ssssid '):
Syntax error close to:
' Qx_ssss ' (' Ssssid ')

Tip in the ' qx_ssss ' (' Ssssid ') near a grammatical error, they should be carefully checked, I made the mistake here is references and its parameters between, less space.

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.