DROP DATABASE IF EXISTS testdollar; CREATE DATABASE testdollar; USE testdollar; CREATE TABLE `table1` ( `ID` BIGINT NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=InnoDB; INSERT INTO table1 VALUES (1), (2); CREATE TABLE `dollar$` ( `DollarID` BIGINT NOT NULL, PRIMARY KEY (`DollarID`) ) ENGINE = InnoDB; INSERT INTO dollar$ VALUES (3), (4); SET FOREIGN_KEY_CHECKS=0; ALTER TABLE `table1` ADD COLUMN `DollarID` BIGINT(20) NOT NULL, ADD CONSTRAINT `fk_1` FOREIGN KEY (`DollarID` ) REFERENCES `dollar$` (`DollarID` ) , ADD INDEX `fk_idx` (`DollarID` ASC) ; SET FOREIGN_KEY_CHECKS=1; update table1 set DollarID = 3;