Mysql errno 150 trying to create table with foreign key references
I'm trying to create a table in mysql with a foreign key reference, like this: In database A: CREATE TABLE replication ( id varchar(255) NOT NULL PRIMARY KEY, uid varchar(255) NOT NULL, value int(11) NOT NULL, FOREIGN KEY (uid) REFERENCES databaseB.users(username) ); In database B i have a table named users like this: +-----------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+--------------+------+-----+---------+-------+ | id | varchar(255) | NO | | NULL | | | username | varchar(255) | NO | PRI | NULL | | +-------------