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.