Questions tagged [mysql-error-1067]

Error 1067: Invalid default value for '%s'

This error will rise when you are setting an invalid default value for a column, like in the followin example:

CREATE TABLE yourtable (
  id INT DEFAULT '',
  name VARCHAR(20)
);

because id is an INT and can't have an empty string as a default value, or in this:

ALTER TABLE yourtable
ADD COLUMN description VARCHAR(30) NOT NULL
DEFAULT NULL;

because description is defined as NOT NULL and can't have a null value as default.

The error 1067 is also a Windows error that indicates that a service could not be started, and it indicates that there's a problem with the installation of the service.

It could happen when you install MySQL in a non-standard directory without specifying where your defaults file’s path is.

36 questions
215
votes
13 answers

Set NOW() as Default Value for datetime datatype?

I have two columns in table users namely registerDate and lastVisitDate which consist of datetime data type. I would like to do the following. Set registerDate defaults value to MySQL NOW() Set lastVisitDate default value to 0000-00-00 00:00:00…
Ibrahim Azhar Armar
  • 25,288
  • 35
  • 131
  • 207
26
votes
28 answers

1067 error on attempt to start MySQL

I've installed MySQL on Windows 7. When I'm trying to start MySQL service I'm getting error 1067: The process terminated unexpectedly. Log message: 101111 22:27:11 [Note] Plugin 'FEDERATED' is disabled. C:\Program Files\MySQL\MySQL Server…
Eugene
  • 59,186
  • 91
  • 226
  • 333
10
votes
3 answers

MySQL: adding current year as a default value for a field 'year'

I have the following table in MySQL (version 5): id int(10) UNSIGNED No auto_increment year varchar(4) latin1_swedish_ci No title varchar(250) latin1_swedish_ci Yes NULL …
markus
9
votes
7 answers

system error 1067 has occurred

Ran into some troubles with XAMPP after MySQL wasn't starting. So, I typed in the command prompt: 'net start MySQL', and it gave me this error message listed in the subject line. Anyone know how to alleviate this? Thanks for your help!
Spencer B.
  • 233
  • 2
  • 7
  • 15
9
votes
3 answers

MySQL Invalid default value for timestamp when no default value is given.

Look at the following sql. CREATE SCHEMA IF NOT EXISTS `scheduler`; USE `scheduler` ; CREATE TABLE IF NOT EXISTS `scheduler`.`JobHistory` ( `Id` INT NOT NULL AUTO_INCREMENT, `Job` INT NOT NULL, `StartTime` TIMESTAMP NOT NULL, `FinishTime`…
Thomas
  • 4,119
  • 2
  • 33
  • 49
8
votes
2 answers

MySQL: Invalid default value for TIMESTAMP

I get the error ERROR 1067 (42000) at line 5459: Invalid default value for 'start_time' when running the following query DROP TABLE IF EXISTS `slow_log`; CREATE TABLE IF NOT EXISTS `slow_log` ( `start_time` timestamp(6) NOT NULL DEFAULT…
Hanxue
  • 12,243
  • 18
  • 88
  • 130
6
votes
4 answers

MySQL two column timestamp default NOW value ERROR 1067

I have table as shown below. In order to workaround one default now column restriction of MySQL I used the tip as shown here CREATE TABLE IF NOT EXISTS mytable ( id INT NOT NULL AUTO_INCREMENT , create_date TIMESTAMP NULL DEFAULT '0000-00-00…
Gok Demir
  • 1,404
  • 4
  • 21
  • 40
5
votes
3 answers

How to set default date time as system date time in mysql

I am trying to set my columns default date time to system datetime. It shows me an error Invalid default value for 'InsertionDate' alter table `vts`.`tblpickpoint` add column `InsertionDate` datetime DEFAULT 'Now()' NULL after…
Shantanu Gupta
  • 20,688
  • 54
  • 182
  • 286
5
votes
1 answer

Windows 7 MySQL Error 1067 Services Will not Start

This has been a nightmare of a problem. I initially installed WAMP and everything worked fine. I restarted my computer and MySQL server hasn't worked since. I have been trying to install just MySQL and the "SQL Instance Config" freezes and when…
Biglu315
  • 191
  • 1
  • 2
  • 8
4
votes
4 answers

Database Schema, Default Value is NOW()

I have database schema for users. It looks like... CREATE TABLE `users` ( `id` int( 8 ) unsigned AUTO_INCREMENT, `username` varchar( 255 ), `password` varchar( 40 ), `level` tinyint( 1 ) unsigned DEFAULT 1, `time` datetime DEFAULT NOW(), `email`…
daGrevis
  • 21,014
  • 37
  • 100
  • 139
4
votes
2 answers

django default foreign key value for users

I've had a read through http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/ but still am having problems migrating my new db schema with a ForeignKey for a user in a list of products a simplified version of my code is: from…
null
  • 1,137
  • 2
  • 11
  • 29
4
votes
4 answers

TIMESTAMP default value error

I exported SQL script with workbench to phpMyAdmin and I get an error because of TIMESTAMP default value. Here's a piece of code: CREATE TABLE IF NOT EXISTS `test`.`is_users` ( `count` INT(10) UNIQUE NOT NULL AUTO_INCREMENT, `active` ENUM('1',…
4
votes
2 answers

#1067 - Invalid default value for 'membership'

I am using a SQL file included in my program and once I fixed an issue that I was able to find the answer to in here (THANK YOU).. I ran it again and got the following error: SQL query: # Create table structure for 'member' table CREATE TABLE…
user1890162
  • 41
  • 1
  • 1
  • 3
3
votes
1 answer

Error code 1067, SQL state 42000: Invalid default value for 'memberSince' when compiling a table

I'm adding a new table to the list of existing tables: CREATE TABLE Counselor ( id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT, firstName VARCHAR (50), nickName VARCHAR (50), lastName VARCHAR (50), telephone VARCHAR (25), email…
Viktor
  • 33
  • 1
  • 6
3
votes
2 answers

mysql - can I set VARCHAR default value as NULL?

In mysql, i tried changing an existing table like this: ALTER TABLE `etexts` CHANGE `etext` `etext` VARCHAR( 100 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT NULL I got the response: #1067 - Invalid default value for…
tzmatt7447
  • 2,329
  • 9
  • 24
  • 31
1
2 3