sql >> Databasteknik >  >> RDS >> Mysql

MySQL 5.5 främmande nyckel-begränsning misslyckas när främmande nyckel finns

Detta verkar vara en bugg som introducerats sedan MySQL 5.5.9 på Mac OS X:http ://bugs.mysql.com/bug.php?id=60309

Det är markerat som fixat i 5.5.13 (släppt 31 maj) och nämnt i release notes:http://dev.mysql.com/doc/refman/5.5/en/news-5-5-13.html

Alternativt finns det en lösning listad i felrapporten som jag har verifierat 5.5.10 och återskapat nedan:

[20 Mar 11:29] Harald Neiss

I also received a new MBP and reinstalled MySQL (mysql-5.5.10-osx10.6-x86_64). Finally I
came across the same problem as described above. So here is the query result and what I
did to solve it.

mysql> show variables like 'lower%';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_file_system | ON    |
| lower_case_table_names | 2     |
+------------------------+-------+
2 rows in set (0.00 sec)

Dropped database, created the file /etc/my.cnf with the following content:

[mysqld]
lower_case_table_names=1

Restarted the MySQL daemon and repeated the query:

mysql> show variables like 'lower%';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| lower_case_file_system | ON    |
| lower_case_table_names | 1     |
+------------------------+-------+
2 rows in set (0.00 sec)

I recreated the tables and everything works fine.



  1. sluta infoga data i databasen när du uppdaterar sidan

  2. En-till-många SQL SELECT i en rad

  3. PHP - MYSQL - testdatabasserver

  4. org.hibernate.internal.util.config.ConfigurationException:Kunde inte hitta cfg.xml-resursen [/HibernateTest/src/hibernate.cfg.xml]