# Temporal server startup

**URL:** <https://community.temporal.io/t/temporal-server-startup/4989>\
**Category:** Community Support\
**Tags:** mysql, server\
**Created:** [June 17, 2022, 4:25am UTC](https://community.temporal.io/t/temporal-server-startup/4989 "2022-06-17T04:25:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![shiva0612](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/shiva0612/32/2152_2.png) [@shiva0612](https://community.temporal.io/u/shiva0612)\
**Post date:** [June 17, 2022, 4:25am UTC](https://community.temporal.io/t/temporal-server-startup/4989/1 "2022-06-17T04:25:01Z")

</div>

**my requirement** : Need to run temoral with mysql running outside the docker-compose  
**what did I do** :

1. cloned the docker-compose repo and changed the docker-compose as follows

```auto
version: "3.5"
services:
  
  temporal:
    container_name: temporal
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      - DB=mysql
      - DB_PORT=3306
      - MYSQL_USER=TemporalUser
      - MYSQL_PWD=mypsw
      - MYSQL_SEEDS=14.20.202.155
      - DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
      - ENABLE_ES=false
      - SKIP_DB_CREATE=true
      - SKIP_SCHEMA_SETUP=true
     
    image: temporalio/auto-setup:${TEMPORAL_VERSION}
    networks:
      - temporal-network
    ports:
      - 7233:7233
    volumes:
      - ./dynamicconfig:/etc/temporal/config/dynamicconfig
  temporal-ui:
    container_name: temporal-ui
    depends_on:
      - temporal
    environment:
      - TEMPORAL_ADDRESS=temporal:7233
      - TEMPORAL_CORS_ORIGINS=http://localhost:3000
    image: temporalio/ui:${TEMPORAL_UI_VERSION}
    networks:
      - temporal-network
    ports:
      - 8080:8080
  temporal-admin-tools:
    container_name: temporal-admin-tools
    depends_on:
      - temporal
    environment:
      - TEMPORAL_CLI_ADDRESS=temporal:7233
    image: temporalio/admin-tools:${TEMPORAL_VERSION}
    networks:
      - temporal-network
    stdin_open: true
    tty: true
  temporal-web:
    container_name: temporal-web
    depends_on:
      - temporal
    environment:
      - TEMPORAL_GRPC_ENDPOINT=temporal:7233
    image: temporalio/web:${TEMPORAL_WEB_VERSION}
    networks:
      - temporal-network
    ports:
      - 8088:8088
networks:
  temporal-network:
    driver: bridge
    name: temporal-network

```

1. few important modification I have done in the above docker-compose  
a) included extra host since my mysql is running on the same machine as a standalone server  
b) there is an error with schema mentioned in " /home/shiva/go/src/temporal-master/schema/mysql/v57/temporal/versioned/v1.0 "  
in schema.sql, in the last table which is " cluster\_membership " the " session\_start " column the default value is giving an error when ever that table is created in mysql 8.0.19,8.0.29,8.0.21  
changing the default value from " 1970-01-01 00:00:01 " to " 1970-01-02 00:00:01 " has fixed the issue

```auto
CREATE TABLE cluster_membership
(
    membership_partition INT NOT NULL,
    host_id BINARY(16) NOT NULL,
    rpc_address VARCHAR(15) NOT NULL,
    rpc_port SMALLINT NOT NULL,
    role TINYINT NOT NULL,
    session_start TIMESTAMP DEFAULT '1970-01-02 00:00:01',
    last_heartbeat TIMESTAMP DEFAULT '1970-01-02 00:00:01',
    record_expiry TIMESTAMP DEFAULT '1970-01-02 00:00:01',
    INDEX (role, host_id),
    INDEX (role, last_heartbeat),
    INDEX (rpc_address, role),
    INDEX (last_heartbeat),
    INDEX (record_expiry),
    PRIMARY KEY (membership_partition, host_id)
);

```

c) hence need to run temporal-sql-tool and skip the schema creation in docker-compose  
d) so, I mentioned in the docker-compose to skip the DB and SCHEMA creation in the temporal container

1. making the changes in the default value in " /home/shiva/go/src/temporal-master/schema/mysql/v57/temporal/versioned/v1.0 " and running the command " make install-schema-mysql " ----\> worked fine —\> few logs are as follows while executing the make command

```auto
executing updates for version 1.2
executing updates for version 1.3
executing updates for version 1.4...
executing updates for version 1.8
finally schema updated from 1.0 to 1.1
UpdateSchemaTask done

```

**current error after doing the above task and running the docker-compose** :

```auto
waiting for temporal server to start
unable to start the server : sql schema version mismatched

```

kindly let me know if any further clarity is required  
and please help me come out of this mess

thanks in advance

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [June 17, 2022, 3:58pm UTC](https://community.temporal.io/t/temporal-server-startup/4989/2 "2022-06-17T15:58:58Z")

</div>

> changing the default value from " 1970-01-01 00:00:01 " to " 1970-01-02 00:00:01 " has fixed the issue

could you [open an issue in Temporal server repo](https://github.com/temporalio/temporal/issues), this does look like a possible bug.

> sql schema version mismatched

what is the ${TEMPORAL\_VERSION} used in your docker config?  
maybe this is version mismatch between server version used and the sql tool version you used to set up the db?

---

<div class="post-metadata">

**Author:** ![shiva0612](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/shiva0612/32/2152_2.png) [@shiva0612](https://community.temporal.io/u/shiva0612)\
**Post date:** [June 19, 2022, 2:56am UTC](https://community.temporal.io/t/temporal-server-startup/4989/3 "2022-06-19T02:56:18Z")

</div>

temporal version used in dock-compose : 1.16.2  
and I had pulled the same github branch (1.16.2) for running the temporal-sql-tool

---

<div class="post-metadata">

**Author:** ![shiva0612](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/shiva0612/32/2152_2.png) [@shiva0612](https://community.temporal.io/u/shiva0612)\
**Post date:** [June 19, 2022, 3:00am UTC](https://community.temporal.io/t/temporal-server-startup/4989/4 "2022-06-19T03:00:25Z")

</div>

According to me whats going wrong is as follows :  
I have run temporal-sql-tool by changing the table (cluster\_membership) default value from

```auto
 " 1970-01-01 00:00:01 " to " 1970-01-02 00:00:01 "

```

and while running the docker-compose file  
even though I have mentioned the variables (to skip DB creation and schema creation)  
it might be validating the schema at some place  
and there comes the schema mismatch  
bcz it is going to use the default value of 1970-01-01 00:00:01 for validating the schema

possible solution might be changing the default value in the temporal github and building new docker image

correct me if im wrong

---

<div class="post-metadata">

**Author:** ![alex](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/alex/32/15_2.png) [@alex](https://community.temporal.io/u/alex)\
**Post date:** [June 22, 2022, 1:23am UTC](https://community.temporal.io/t/temporal-server-startup/4989/5 "2022-06-22T01:23:03Z")

</div>

1. We are running MySQL [8.0.19](https://github.com/temporalio/temporal/blob/c7e9e938b4ebc8a10c08239849a031733c87b506/develop/docker-compose/docker-compose.yml#L9) and it does work well with [‘1970-01-01 00:00:01’](https://github.com/temporalio/temporal/blob/ee8dda3263b9849cbcebd8a325eab9e24df547cc/schema/mysql/v57/temporal/schema.sql#L267-L269) as default. I am curious why it doesn’t work for you. May be because of time zone? Can you try `‘1970-01-01 00:00:01+00:00’ as default value?
2. `make install-schema-mysql` create database and schema on 127.0.0.1 by default. Unless you modified [Makefile](https://github.com/temporalio/temporal/blob/ebe226256d182a3f3a10804bc3bea2e24d153b22/Makefile#L352) also, your database was created on the wrong server. I would suggest you to manually run [temporal-sql-tool](https://github.com/temporalio/temporal/blob/ebe226256d182a3f3a10804bc3bea2e24d153b22/Makefile#L352-L355) commands, specifying correct `--endpoint` and create database on the correct server.
