Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Sql error after fresh install #1215

Closed
Wewannado opened this issue Jul 12, 2017 · 9 comments
Closed

Sql error after fresh install #1215

Wewannado opened this issue Jul 12, 2017 · 9 comments

Comments

@Wewannado
Copy link

Summary

Did a fresh install
After install, when entering the site, I receive the error:

Database Error: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'updated'
SQL: ALTER TABLE anchor_posts ADD COLUMN updated DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP AFTER created
The error has been logged in /anchor/errors.log

Expected Behaviour

  • The main page

Actual Behaviour

  • After a fresh install (clean database too) I receive the stated SQL error.

Context details (if applicable)

  • Anchor version: 0.12.3
  • Server setup:
    Server: Lighttp 1.4.35
    PHP 5.6.30
    Mysql: 5.5.55
  • URL root page. (/)
@Wewannado
Copy link
Author

Wewannado commented Jul 12, 2017

Ok, after some digging, (and a more extensive reading of the current open issues) DATETIME DEFAULT CURRENT_TIMESTAMP ... is only available in MySQL 5.6+.

Somebody needs to update the Docs https://anchorcms.com/docs because it says MySQL 5.2+ is required.
Should be 5.6+.

Worked fine after upgrading the mysql package. (Updated to mysql-5.7-5.7.18)

@Wewannado Wewannado reopened this Jul 12, 2017
@daviddarnes
Copy link
Member

Thanks for the spot! We do have this in our new documentation https://docs.anchorcms.com/ but it looks like the redirect isn't working. @rwarasaurus could you look into this?

@TheBrenny
Copy link
Member

This is a duplicate of #1205. Would've saved some time for you if you had searched the issues on GH like the guidelines ask. 😖

This has been fixed within the repo, however I understand it's slightly misleading for the two documentation pages to have conflicting information. I guess once @rwarasaurus jumps on to fix it, this'll stay open.

@Wewannado
Copy link
Author

Regarding the fix in the repo:
Im not sure if PHP 5.6+ is required, because I had 5.6.30 from the beggining, but what I'm sure is that It's actually MySQL, as stated in https://stackoverflow.com/questions/168736/how-do-you-set-a-default-value-for-a-mysql-datetime-column who needs to be in a version greater than 5.6.5 in order to use DATETIME DEFAULT CURRENT_TIMESTAMP

Current documentation, https://docs.anchorcms.com/ and https://anchorcms.com/docs doesn't reflect this.

@daviddarnes
Copy link
Member

@Wewannado thanks for pointing this out! Shame its such a specific version for usage, any way we can easily make this compatible with the main 5.6 ver?

@TheBrenny
Copy link
Member

@Wewannado Wowee. What was I thinking writing an issue for an incompatible MySQL version, but then apply a patch which bumps the PHP req. 😅 Cheers for pointing that out to me!

I'll reopen the initial issue, and apply an actual fix for it as soon as I can, using the PDO::getAttribute(PDO::ATTR_SERVER_VERSION) method.

@sjpmax
Copy link

sjpmax commented Dec 29, 2017

@Wewannado , @TheBrenny , @daviddarnes : this is still an issue.

This says 5.2, but is not working with my 5.5. https://anchorcms.com/docs/getting-started/requirements

@Wewannado
Copy link
Author

It only works with MySQL 5.6+ althought it's not yet reflected in the homepage.

Writing a fix for versions 5.5 or older would be too troublesome, so, because most servers should actually been using the updated versions of MySQL, It was chosen to bump the MySQL version to 5.6

@CraigChilds94
Copy link
Member

We've updated the requirements to reflect what the project supports and to keep in line with up to date software; MySQL 5.6 is now a min requirement. :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants