Personally I've researched several other topics about this error and none solved my problem so I'm posting here for you. It is as follows: I have a table called "members" that already has content and I am creating a new table called member_photos which has nothing in it. In this table I have the following columns: id, member_id, photo. Both the member_id and the id of the members table are in the following configuration: int-11 and both tables are in the InnoDB engine. My problem is that when I try to create the Foreign key in the member_photo table it gives me the 1512 error. Why does this happen? and how to solve?
mysql> desc membros;
+---------------------+------------------+------+-----+---------+----------------
| Field | Type | Null | Key | Default | Extra |
+---------------------+------------------+------+-----+---------+----------------+
| id | int(11) unsigned | NO | PRI | NULL | auto_increment |
| nome | varchar(100) | YES | | NULL | |
| nascimento | varchar(10) | YES | | NULL | |
| falecimento | varchar(10) | YES | | NULL | |
mysql> desc membro_images;
+---------------+--------------+------+-----+---------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-----------------------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| membro_id | int(11) | YES | MUL | NULL | |
| name | varchar(255) | YES | | NULL | |
| created_at | timestamp | YES | | NULL | on update CURRENT_TIMESTAMP |
| updated_at | timestamp | YES | | NULL | on update CURRENT_TIMESTAMP |
+---------------+--------------+------+-----+---------+-----------------------------+