#1067 - Invalid default value for 'created_date'

  • You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

  • You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

imabotmail

Active member
Trusted Uploader
Jan 17, 2020
297
224
43
I'm trying to run the following query into mysql via phpmyadmin and I keep getting this error and I don't know know how to solve it.

Spoiler

I've tried to everything listed here: Google Search and nothing works. What am I doing wrong? Any mysql expert here, please help.
 

jackdanielz

New member
May 5, 2022
14
7
3
I'm trying to run the following query into mysql via phpmyadmin and I keep getting this error and I don't know know how to solve it.

Spoiler

I've tried to everything listed here: Google Search and nothing works. What am I doing wrong? Any mysql expert here, please help.

If you replace the following two lines, it should work.

`created_date` datetime DEFAULT NOT NULL CURRENT_TIMESTAMP,
`updated_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

or

`created_date` datetime DEFAULT NOT NULL CURRENT_TIMESTAMP,
`updated_date` datetime DEFAULT NOW()
 

imabotmail

Active member
Trusted Uploader
Jan 17, 2020
297
224
43
I get this:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NOT NULL CURRENT_TIMESTAMP,
`updated_date` datetime DEFAULT CURRENT_TIMESTAMP' at line 17
 

jackdanielz

New member
May 5, 2022
14
7
3
I get this:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NOT NULL CURRENT_TIMESTAMP,
`updated_date` datetime DEFAULT CURRENT_TIMESTAMP' at line 17

`created_date` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NUll,
`updated_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

or

`created_date` datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
`updated_date` datetime DEFAULT NOW()

Sorry, I guess I need a coffee.. ;)
 
Last edited:

imabotmail

Active member
Trusted Uploader
Jan 17, 2020
297
224
43
😂 I hear you. Brewing a fresh pot as we speak. LOL Sorry, neither one work. :(
A little insight, I'm running Plesk CP with mysql 5.5.68-MariaDB and can't upgrade either.
 

jackdanielz

New member
May 5, 2022
14
7
3
😂 I hear you. Brewing a fresh pot as we speak. LOL Sorry, neither one work. :(
A little insight, I'm running Plesk CP with mysql 5.5.68-MariaDB and can't upgrade either.
Oh dear... this is an old version of mysql, it is not implemented there yet.

Try the following:
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_date` timestamp NOT NULL DEFAULT ' 0000-00-00 00:00:00 '
 

imabotmail

Active member
Trusted Uploader
Jan 17, 2020
297
224
43
Nope, but different error: #1005 - Can't create table 'scmdb.online_courses' (errno: 150)
 

jackdanielz

New member
May 5, 2022
14
7
3
Nope, but different error: #1005 - Can't create table 'scmdb.online_courses' (errno: 150)
It could be the "Foreign Key"... Add it before and after your query.

SET FOREIGN_KEY_CHECKS = 0;
CREATE TABLE `online_courses` (
...
`created_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_date` timestamp NOT NULL DEFAULT NOW()
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;

If that doesn't work, I'm afraid I'm out. :)
 
  • Like
Reactions: TassieNZ

imabotmail

Active member
Trusted Uploader
Jan 17, 2020
297
224
43
Thank you my friend @jackdanielz - I too, I'm giving up. Sadly this gives the following error. Thanks for all your help.

#1005 - Can't create table 'scmdb.online_courses' (errno: 150)
 
AdBlock Detected

Hi bro. Can you please help us?

I know the ads sometimes are too annoying and you want to use Adblock. But I think you can support us by adding Babiato to the whitelist. It will help us and our community.

Thanks for your help!

I've Disabled AdBlock