I am setting up Hyperledger-Fabric-CA-Server with mySQL database. It is giving the following error while creating the talbes. [ERROR] Error occurred initializing database: Failed to create MySQL tables: Error creating certificates table: Error 1067: Invalid default value for 'expiry'
2019/10/20 08:28:36 [INFO] Configuration file location: /home/adnan/ca-server/fabric-ca-server-config.yaml
2019/10/20 08:28:36 [INFO] Starting server in home directory: /home/adnan/ca-server
2019/10/20 08:28:36 [INFO] Server Version: 1.4.4
2019/10/20 08:28:36 [INFO] Server Levels: &{Identity:2 Affiliation:1 Certificate:1 Credential:1 RAInfo:1 Nonce:1}
2019/10/20 08:28:36 [INFO] The CA key and certificate already exist
2019/10/20 08:28:36 [INFO] The key is stored by BCCSP provider 'SW'
2019/10/20 08:28:36 [INFO] The certificate is at: /home/adnan/ca-server/ca-cert.pem
2019/10/20 08:28:36 [ERROR] Error occurred initializing database: Failed to create MySQL tables: Error creating certificates table: Error 1067: Invalid default value for 'expiry'
2019/10/20 08:28:36 [INFO] Home directory for default CA: /home/adnan/ca-server
2019/10/20 08:28:36 [INFO] Operation Server Listening on 127.0.0.1:9443
2019/10/20 08:28:36 [INFO] Listening on http://0.0.0.0:7054
You need to remove NO_ZERO_DATE
from the SQL Mode if you are using MySQL 5.7. In later versions of MySQL I believe this setting has been removed but is included when strict
mode is enabled (so in that case you'll need to disable strict mode).