Product SiteDocumentation Site

18.3. Changing the Database Password

You may need to change the password for the MySQL account used by CloudStack. If so, you'll need to change the password in MySQL, and then add the encrypted password to /etc/cloudstack/management/db.properties.
  1. Before changing the password, you'll need to stop CloudStack's management server and the usage engine if you've deployed that component.
    # service cloudstack-management stop
    # service cloudstack-usage stop
  2. Next, you'll update the password for the CloudStack user on the MySQL server.
    # mysql -u root -p
    At the MySQL shell, you'll change the password and flush privileges:
    update mysql.user set password=PASSWORD("newpassword123") where User='cloud';
    flush privileges;
    quit;
  3. The next step is to encrypt the password and copy the encrypted password to CloudStack's database configuration (/etc/cloudstack/management/db.properties).
        # java -classpath /usr/share/cloudstack-common/lib/jasypt-1.9.0.jar \ org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI encrypt.sh \ input="newpassword123" password="`cat /etc/cloudstack/management/key`" \ verbose=false 

    File encryption type

    Note that this is for the file encryption type. If you're using the web encryption type then you'll use password="management_server_secret_key"
  4. Now, you'll update /etc/cloudstack/management/db.properties with the new ciphertext. Open /etc/cloudstack/management/db.properties in a text editor, and update these parameters:
    db.cloud.password=ENC(encrypted_password_from_above) 
    db.usage.password=ENC(encrypted_password_from_above)
    
  5. After copying the new password over, you can now start CloudStack (and the usage engine, if necessary).
            # service cloudstack-management start
            # service cloud-usage start