Upgrading 5.31.1

Hello, I attempted to upgrade my 5.3.1 instance in this guide:
To mattermost version 7.10. I erroneously thought the version we were hosting was 5.35.5 and decided to make the massive jump. I was wrong and it was 5.3.1.
After attempting the upgrade the mattermost service will not start and I get an error that the database migration failed and the sql error said it was that the mattermost user didnt have access (It does, and i was able to sign into mysql and change values in db manually).
I then attempted to upgrade the version to 5.35.5, that also did not work.
I just rolled back to 5.3.1 and it works fine again.

This was the error I got on the 7.10 upgrade

root@ubuntu-s-1vcpu-2gb-nyc3-01-mm:/opt/mattermost# sudo -u mattermost ./bin/mattermost
{"timestamp":"2023-07-08 19:57:50.564 Z","level":"info","msg":"Server is initializing...","caller":"platform/service.go:165","go_version":"go1.19.5"}
{"timestamp":"2023-07-08 19:57:50.564 Z","level":"info","msg":"Pinging SQL","caller":"sqlstore/store.go:242","database":"master","dataSource":"****:****@tcp("}
{"timestamp":"2023-07-08 19:57:50.615 Z","level":"info","msg":"Pinging SQL","caller":"sqlstore/store.go:242","database":"master","dataSource":"****:****@tcp("}
{"timestamp":"2023-07-08 19:57:50.631 Z","level":"fatal","msg":"Failed to apply database migrations.","caller":"sqlstore/store.go:170","error":"driver: mysql, message: failed when applying migration, command: apply_migration, originalError: Error 1044 (42000): Access denied for user 'mmapp'@'%' to database 'mattermost', 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"}

and here is the error i got for the 5.35.5

Error: failed to load configuration: failed to create store: unable to load on store creation: invalid config: Config.IsValid: model.config.is_valid.collapsed_threads.app_error,

At this point I dont know what to do. Is there anything precursor steps? I read the prepare guide but I didnt see anything at the time to do for me and my instance. Unless im just being dense this late saturday afternoon.
I really appreciate anyones response into this matter.
Been happily using MM for years though :slight_smile:

Hi mich,

I’m sorry to hear about the issues you’re facing during the upgrade process. Let’s try to troubleshoot the problem and find a solution.

Regarding the failed upgrade to version 7.10, the error message suggests that the Mattermost user (mmapp) doesn’t have access to the Mattermost database. However, you mentioned that you were able to sign into MySQL and change values manually, so it seems that the user does have access. To further investigate this, please check the following:

  1. Ensure that the Mattermost user (mmapp) has the necessary privileges on the Mattermost database. You can verify this by running the following command in MySQL: SHOW GRANTS FOR 'mmapp'@'%';
  2. Double-check the database configuration in your Mattermost configuration file (config.json or config.yaml). Make sure that the username, password, and database name are correctly specified.

Regarding the attempt to upgrade to version 5.35.5, the error message indicates an issue with the configuration file. To resolve this, please follow these steps:

  1. Make sure you have a backup of your existing Mattermost installation before proceeding.
  2. Check your existing config.json or config.yaml file for any customizations or plugins that might be causing the issue. You can try temporarily removing those customizations and plugins to see if the upgrade process can proceed.
  3. If the issue persists, consider generating a new default configuration file using the platform command. Run the following command from your Mattermost installation directory:
sudo -u mattermost ./bin/mattermost platform config > new_config.json

This command will generate a new configuration file (new_config.json) with default settings. You can then compare this file with your existing configuration file to identify any discrepancies or missing settings.
4. Once you have a new configuration file, try the upgrade process again using the new_config.json file. Make sure to update the necessary paths and settings in the new file before proceeding.

If you encounter any errors or issues during the upgrade process, please share the specific error messages or logs so that I can assist you further.

Remember to always have a backup of your Mattermost instance before attempting any upgrades or modifications to ensure you can easily revert back if needed.

Hope this helps,
~Matterbot 1.0

[Disclaimer: This is a new automated response feature we’re testing powered by ChatGPT. Please be aware that this response should be considered as a simulated suggestion and may not always reflect official Mattermost recommendations or support. Use the information provided at your own discretion. Were any of the above suggestions inaccurate? Please feel free to reply with any suggested corrections!]