# Fail to upgrade to 6.4.1 - SOLVED

**URL:** <https://forum.mattermost.com/t/fail-to-upgrade-to-6-4-1-solved/13059>\
**Category:** Troubleshooting\
**Created:** [March 7, 2022, 7:07am UTC](https://forum.mattermost.com/t/fail-to-upgrade-to-6-4-1-solved/13059 "2022-03-07T07:07:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@loic](https://forum.mattermost.com/u/loic)\
**Post date:** [March 7, 2022, 7:07am UTC](https://forum.mattermost.com/t/fail-to-upgrade-to-6-4-1-solved/13059/1 "2022-03-07T07:07:11Z")

</div>

Cannot upgrade from 6.3.4 to 6.4.1

I have a small VPS with Mattermost 6.3.4 installed alongside with the database (10.4.24-MariaDB). I follow the usual steps to upgrade but the service won’t start:

systemctl status mattermost.service -l  
● mattermost.service - Mattermost  
Loaded: loaded (/etc/systemd/system/mattermost.service; enabled; vendor preset: disabled)  
Active: failed (Result: exit-code) since lun. 2022-03-07 07:20:28 CET; 44s ago  
Process: 7781 ExecStart=/opt/mattermost/bin/mattermost (code=exited, status=1/FAILURE)  
Main PID: 7781 (code=exited, status=1/FAILURE)

mars 07 07:20:27 \*\*\* systemd[1]: Starting Mattermost…  
mars 07 07:20:28 \*\*\* mattermost[7781]: {“timestamp”:“2022-03-07 07:20:28.130 +01:00”,“level”:“info”,“msg”:“Server is initializing…”,“caller”:“app/server.go:237”,“go\_version”:“go1.16.7”}  
mars 07 07:20:28 \*\*\* mattermost[7781]: {“timestamp”:“2022-03-07 07:20:28.131 +01:00”,“level”:“info”,“msg”:“Starting websocket hubs”,“caller”:“app/web\_hub.go:93”,“number\_of\_hubs”:2}  
mars 07 07:20:28 \*\*\* mattermost[7781]: {“timestamp”:“2022-03-07 07:20:28.131 +01:00”,“level”:“info”,“msg”:“Pinging SQL”,“caller”:“sqlstore/store.go:215”,“database”:“master”}  
mars 07 07:20:28 \*\*\* mattermost[7781]: {“timestamp”:“2022-03-07 07:20:28.197 +01:00”,“level”:“info”,“msg”:“Pinging SQL”,“caller”:“sqlstore/store.go:215”,“database”:“master”}  
mars 07 07:20:28 \*\*\* mattermost[7781]: 2022/03/07 07:20:28 == create\_commands: migrating ====================================================================  
mars 07 07:20:28 \*\*\* systemd[1]: mattermost.service: main process exited, code=exited, status=1/FAILURE  
mars 07 07:20:28 \*\*\* systemd[1]: Failed to start Mattermost.  
mars 07 07:20:28 \*\*\* systemd[1]: Unit mattermost.service entered failed state.  
mars 07 07:20:28 \*\*\* systemd[1]: mattermost.service failed.

I updated the database with  
`ALTER DATABASE <YOUR_DB_NAME> COLLATE = 'utf8mb4_general_ci',`

I have the following log, which tells me to use mysql\_upgrade to fix this error:  
{“timestamp”:“2022-03-07 07:17:39.238 +01:00”,“level”:“info”,“msg”:“Stopping Server…”,“caller”:“app/server.go:922”}  
{“timestamp”:“2022-03-07 07:17:39.239 +01:00”,“level”:“info”,“msg”:“stopping websocket hub connections”,“caller”:“app/web\_hub.go:113”}  
{“timestamp”:“2022-03-07 07:17:39.243 +01:00”,“level”:“error”,“msg”:“RPC call OnWebSocketDisconnect to plugin failed.”,“caller”:“plugin/client\_rpc\_generated.go:620”,“plugin\_id”:“focalboard”,“error”:“connection is shut down”}  
{“timestamp”:“2022-03-07 07:17:39.328 +01:00”,“level”:“info”,“msg”:“Stopped workers”,“caller”:“jobs/workers.go:353”}  
{“timestamp”:“2022-03-07 07:17:39.328 +01:00”,“level”:“info”,“msg”:“Stopping schedulers.”,“caller”:“jobs/schedulers.go:187”}  
{“timestamp”:“2022-03-07 07:17:39.328 +01:00”,“level”:“info”,“msg”:“Schedulers stopped.”,“caller”:“jobs/schedulers.go:119”}  
{“timestamp”:“2022-03-07 07:17:39.329 +01:00”,“level”:“info”,“msg”:“Server stopped”,“caller”:“app/server.go:1002”}  
{“timestamp”:“2022-03-07 07:17:39.329 +01:00”,“level”:“info”,“msg”:“Shutting down plugins”,“caller”:“app/plugin.go:339”}  
{“timestamp”:“2022-03-07 07:17:39.344 +01:00”,“level”:“error”,“msg”:“RPC call OnDeactivate to plugin failed.”,“caller”:“plugin/client\_rpc\_generated.go:33”,“plugin\_id”:“com.github.matterpoll.matterpoll”,“error”:“connection is shut down”}  
{“timestamp”:“2022-03-07 07:17:39.344 +01:00”,“level”:“warn”,“msg”:“error closing client during Kill”,“caller”:“plugin/hclog\_adapter.go:70”,“plugin\_id”:“com.github.matterpoll.matterpoll”,“wrapped\_extras”:“errconnection is shut down”}  
{“timestamp”:“2022-03-07 07:17:39.344 +01:00”,“level”:“warn”,“msg”:“plugin failed to exit gracefully”,“caller”:“plugin/hclog\_adapter.go:72”,“plugin\_id”:“com.github.matterpoll.matterpoll”}  
{“timestamp”:“2022-03-07 07:17:39.346 +01:00”,“level”:“warn”,“msg”:“error closing client during Kill”,“caller”:“plugin/hclog\_adapter.go:70”,“plugin\_id”:“com.mattermost.plugin-channel-export”,“wrapped\_extras”:“errconnection is shut down”}  
{“timestamp”:“2022-03-07 07:17:39.346 +01:00”,“level”:“warn”,“msg”:“plugin failed to exit gracefully”,“caller”:“plugin/hclog\_adapter.go:72”,“plugin\_id”:“com.mattermost.plugin-channel-export”}  
{“timestamp”:“2022-03-07 07:17:39.346 +01:00”,“level”:“error”,“msg”:“RPC call OnDeactivate to plugin failed.”,“caller”:“plugin/client\_rpc\_generated.go:33”,“plugin\_id”:“com.mattermost.nps”,“error”:“connection is shut down”}  
{“timestamp”:“2022-03-07 07:17:39.346 +01:00”,“level”:“warn”,“msg”:“error closing client during Kill”,“caller”:“plugin/hclog\_adapter.go:70”,“plugin\_id”:“com.mattermost.nps”,“wrapped\_extras”:“errconnection is shut down”}  
{“timestamp”:“2022-03-07 07:17:39.346 +01:00”,“level”:“warn”,“msg”:“plugin failed to exit gracefully”,“caller”:“plugin/hclog\_adapter.go:72”,“plugin\_id”:“com.mattermost.nps”}  
{“timestamp”:“2022-03-07 07:17:39.346 +01:00”,“level”:“warn”,“msg”:“error closing client during Kill”,“caller”:“plugin/hclog\_adapter.go:70”,“plugin\_id”:“playbooks”,“wrapped\_extras”:“errconnection is shut down”}  
{“timestamp”:“2022-03-07 07:17:39.346 +01:00”,“level”:“warn”,“msg”:“plugin failed to exit gracefully”,“caller”:“plugin/hclog\_adapter.go:72”,“plugin\_id”:“playbooks”}  
{“timestamp”:“2022-03-07 07:17:39.346 +01:00”,“level”:“error”,“msg”:“RPC call OnDeactivate to plugin failed.”,“caller”:“plugin/client\_rpc\_generated.go:33”,“plugin\_id”:“focalboard”,“error”:“connection is shut down”}  
{“timestamp”:“2022-03-07 07:17:39.346 +01:00”,“level”:“warn”,“msg”:“error closing client during Kill”,“caller”:“plugin/hclog\_adapter.go:70”,“plugin\_id”:“focalboard”,“wrapped\_extras”:“errconnection is shut down”}  
{“timestamp”:“2022-03-07 07:17:39.346 +01:00”,“level”:“warn”,“msg”:“plugin failed to exit gracefully”,“caller”:“plugin/hclog\_adapter.go:72”,“plugin\_id”:“focalboard”}  
{“timestamp”:“2022-03-07 07:20:28.130 +01:00”,“level”:“info”,“msg”:“Server is initializing…”,“caller”:“app/server.go:237”,“go\_version”:“go1.16.7”}  
{“timestamp”:“2022-03-07 07:20:28.131 +01:00”,“level”:“info”,“msg”:“Starting websocket hubs”,“caller”:“app/web\_hub.go:93”,“number\_of\_hubs”:2}  
{“timestamp”:“2022-03-07 07:20:28.131 +01:00”,“level”:“info”,“msg”:“Pinging SQL”,“caller”:“sqlstore/store.go:215”,“database”:“master”}  
{“timestamp”:“2022-03-07 07:20:28.197 +01:00”,“level”:“info”,“msg”:“Pinging SQL”,“caller”:“sqlstore/store.go:215”,“database”:“master”}  
{“timestamp”:“2022-03-07 07:20:28.446 +01:00”,“level”:“fatal”,“msg”:“Failed to apply database migrations.”,“caller”:“sqlstore/store.go:157”,“error”:“driver: mysql, message: failed when applying migration, command: apply\_migration, originalError: Error 1558: Column count of mysql.proc is wrong. Expected 21, found 20. Created with MariaDB 50565, now running 100424. Please use mysql\_upgrade to fix this error, query: \n\nCREATE TABLE IF NOT EXISTS Commands (\n Id varchar(26) NOT NULL,\n Token varchar(26) DEFAULT NULL,\n CreateAt bigint(20) DEFAULT NULL,\n UpdateAt bigint(20) DEFAULT NULL,\n DeleteAt bigint(20) DEFAULT NULL,\n CreatorId varchar(26) DEFAULT NULL,\n TeamId varchar(26) DEFAULT NULL,\n `Trigger` varchar(128) DEFAULT NULL,\n Method varchar(1) DEFAULT NULL,\n Username varchar(64) DEFAULT NULL,\n IconURL text,\n AutoComplete tinyint(1) DEFAULT NULL,\n AutoCompleteDesc text,\n AutoCompleteHint text,\n DisplayName varchar(64) DEFAULT NULL,\n Description varchar(128) DEFAULT NULL,\n URL text,\n PRIMARY KEY (Id),\n KEY idx\_command\_team\_id (TeamId),\n KEY idx\_command\_update\_at (UpdateAt),\n KEY idx\_command\_create\_at (CreateAt),\n KEY idx\_command\_delete\_at (DeleteAt)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\n\nSET @preparedStatement = (SELECT IF(\n (\n SELECT COUNT(_) FROM INFORMATION\_SCHEMA.COLUMNS\n WHERE table\_name = ‘Commands’\n AND table\_schema = DATABASE()\n AND column\_name = ‘PluginId’\n ) \> 0,\n ‘SELECT 1’,\n ‘ALTER TABLE Commands ADD PluginId varchar(190);’\n));\n\nPREPARE alterIfNotExists FROM @preparedStatement;\nEXECUTE alterIfNotExists;\nDEALLOCATE PREPARE alterIfNotExists;\n\nCREATE PROCEDURE Migrate\_If\_Version\_Below\_5280 ()\nBEGIN\nDECLARE\n\tCURRENT\_DB\_VERSION TEXT;\nDECLARE\n SYSTEMS\_TABLE\_EXISTS INT;\n SELECT COUNT(_)\n FROM INFORMATION\_SCHEMA.COLUMNS\n WHERE\n TABLE\_NAME = ‘Systems’\n AND table\_schema = DATABASE() INTO SYSTEMS\_TABLE\_EXISTS;\n IF (SYSTEMS\_TABLE\_EXISTS \> 0) THEN\n\t SELECT\n\t\t Value\n\t FROM\n\t\t Systems\n\t WHERE\n\t\t Name = ‘Version’ INTO CURRENT\_DB\_VERSION;\n\t IF(INET\_ATON(CURRENT\_DB\_VERSION) \< INET\_ATON(‘5.28.0’)) THEN\n\t\t UPDATE Commands SET PluginId = ‘’ WHERE PluginId IS NULL;\n\t END IF;\n END IF;\nEND;\n\tCALL Migrate\_If\_Version\_Below\_5280 ();\n\tDROP PROCEDURE IF EXISTS Migrate\_If\_Version\_Below\_5280;\n\n”}

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@loic](https://forum.mattermost.com/u/loic)\
**Post date:** [March 8, 2022, 6:25am UTC](https://forum.mattermost.com/t/fail-to-upgrade-to-6-4-1-solved/13059/2 "2022-03-08T06:25:31Z")

</div>

Solved with  
mysql\_upgrade -u root -p  
service mysqld restart
