mysql5

MySQL 5.5 foreign key constraint fails when foreign key exists

北慕城南 提交于 2019-11-27 09:17:49
Just installed MySQL 5.5 on mac os x 10.6 and am having a strange issue on many tables. Below is an example. Inserting a row fails with a foreign key constraint when it shouldn't. The foreign key it references does exist. Any ideas? mysql> show create table Language; +----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

JDBC Driver class not found: com.mysql.jdbc.Driver

别来无恙 提交于 2019-11-27 03:18:06
问题 I am developing a web application using maven spring and hibernate and I need to create schema using hibernate for which I had the following in my pom.xml to connect to MySQL 5.5 database. <!-- MySql 5.5 Connector --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.15</version> </dependency> This imported mysql-connector-java-5.1.15.jar in my Libraries under Maven Dependencies but when I try to connect to database it gives me Exception in

MySQL Levenshtein

拜拜、爱过 提交于 2019-11-26 20:47:12
问题 I'm trying to create a MySQL function for calculating the levenshtein distance. I found a function which looked pretty close to what I need, however it keeps throwing errors everywhere - I am new to MySQL functions so I have no idea what is wrong? Here is the function: DELIMITER $$ CREATE FUNCTION LEVENSHTEIN( s1 CHAR(255), s2 CHAR(255)) RETURNS int(3) DETERMINISTIC BEGIN DECLARE s1_len, s2_len, i, j, c, c_temp, cost INT; DECLARE s1_char CHAR(255); DECLARE cv0, cv1 CHAR(255); SET s1_len =

MySQL 1062 - Duplicate entry '0' for key 'PRIMARY'

被刻印的时光 ゝ 提交于 2019-11-26 18:52:51
I have the following table in MySQL version 5.5.24 DROP TABLE IF EXISTS `momento_distribution`; CREATE TABLE IF NOT EXISTS `momento_distribution` ( `momento_id` INT(11) NOT NULL, `momento_idmember` INT(11) NOT NULL, `created_at` DATETIME DEFAULT NULL, `updated_at` DATETIME DEFAULT NULL, `unread` TINYINT(1) DEFAULT '1', `accepted` VARCHAR(10) NOT NULL DEFAULT 'pending', `ext_member` VARCHAR(255) DEFAULT NULL, PRIMARY KEY (`momento_id`, `momento_idmember`), KEY `momento_distribution_FI_2` (`momento_idmember`), KEY `accepted` (`accepted`, `ext_member`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; It

MySQL 5.5 foreign key constraint fails when foreign key exists

久未见 提交于 2019-11-26 14:37:42
问题 Just installed MySQL 5.5 on mac os x 10.6 and am having a strange issue on many tables. Below is an example. Inserting a row fails with a foreign key constraint when it shouldn't. The foreign key it references does exist. Any ideas? mysql> show create table Language; +----------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

MySQL 1062 - Duplicate entry &#39;0&#39; for key &#39;PRIMARY&#39;

北战南征 提交于 2019-11-26 05:34:58
问题 I have the following table in MySQL version 5.5.24 DROP TABLE IF EXISTS `momento_distribution`; CREATE TABLE IF NOT EXISTS `momento_distribution` ( `momento_id` INT(11) NOT NULL, `momento_idmember` INT(11) NOT NULL, `created_at` DATETIME DEFAULT NULL, `updated_at` DATETIME DEFAULT NULL, `unread` TINYINT(1) DEFAULT \'1\', `accepted` VARCHAR(10) NOT NULL DEFAULT \'pending\', `ext_member` VARCHAR(255) DEFAULT NULL, PRIMARY KEY (`momento_id`, `momento_idmember`), KEY `momento_distribution_FI_2` (

Are table names in MySQL case sensitive?

╄→尐↘猪︶ㄣ 提交于 2019-11-25 22:49:46
问题 Are table names in MySQL case sensitive? On my Windows dev machine the code I have is able to query my tables which appear to be all lowercase. When I deploy to the test server in our datacenter the table names appear to start with an uppercase letter. The servers we use are all on Ubuntu. 回答1: In General: Database and table names are not case sensitive in Windows, and case sensitive in most varieties of Unix. In MySQL, databases correspond to directories within the data directory. Each table