VMmanager Knowledge Base

How to change the user's email

 

In the current version of VMmanager 6, you cannot change the user's email (login) through the interface.

Possible ways to change the user's email:

  •       register a user with a new email and specify them as the owner of the necessary VMs;
  •       edit the email address in tables vm_account, auth_user и msgs_user2delivery_method.

The second way would require editing of the database, which involves a potential risk. We do not recommend making manual edits to the database, as it can disrupt the correct operation of the platform.

Instructions to make changes to the database should be performed only after backing up the platform. 

Changing the user's email through the database

  1. Perform a backup of the platform. See Backups of VMmanager 6 documentation for details.
    1. Connect to the server with VMmanager via SSH and enter the command: 

      vm backup
    2.  Enter the password for the backup archive or press Enter to create an archive without a password. The backup will be saved in /opt/ispsystem/vm/backup/.
  2. Connect to MySQL:

    docker exec -it mysql bash -c "mysql isp -p\$MYSQL_ROOT_PASSWORD"
  3. Execute the query to the database from the auth_user table to determine the current email address and user ID: 


    select id,email from auth_user where email='example@example.com';

    Example of response:

    *************************** 1. row ***************************
       id: 100
    email: example@example.com
    1 row in set (0.00 sec)
    Comments
  4. If the response above contains the required email address, edit it in the auth_user table:

    update auth_user set email='new_example@example.ru' where id=100\G;
    Comments
  5. Do the same for the vm_account table. Query: 

    select id,email from vm_account where email='example@example.com'; 

    Example of response: 

    *************************** 1. row ***************************
       id: 100
    email: example@example.com
    1 row in set (0.00 sec)
    Comments
  6.   If the response above contains the required email address, edit it in the vm_account table:

    update vm_account set email='new_example@example.ru' where id=100;
    Comments
  7. Execute the query to the database from the msgs_user2delivery_method table to determine the email address and user ID:

    select user, u2dm_params from msgs_user2delivery_method where u2dm_params regexp 'example@example.com';

    Example of response:  

    *************************** 1. row ***************************
           user: 100
    u2dm_params: {"email": "example@example.com"}
    1 row in set (0.00 sec)
    Comments
  8. If the response above contains the required email address, edit it in the msgs_user2delivery_method table:

    update msgs_user2delivery_method set u2dm_params='{'email': 'new_example@example.com'}' where user=100;
    Comments
  9. Restart VMmanager: 

    vm restart
  10. Repeat the queries from steps 3, 5, 7 to make sure that the email address has been changed.