If you are trying to insert new field in your table and connect to another table via foreign key but you are getting "1452 Cannot add or update a child row: a foreign key constraint fails" error, here is how to fix it.
Actually the fix is pretty easy, the problem that your DB is trying to tell you here is, that there is no data in your foreign table. So for example, if you want to add language_id field to your user table and connect it via foreign key to language table, you could get this error just because your language table is empty. So first add some data to it and then you will be able to make a connection