diff --git a/redirections.yml b/redirections.yml index f498a1efe..071f344fe 100644 --- a/redirections.yml +++ b/redirections.yml @@ -605,6 +605,9 @@ - old: "/databases/mysql/workbench" new: "/databases/mysql/accessing" + - + old: "/databases/mysql/managing" + new: "/databases/mysql/overview" - old: "/databases/postgresql/managing" new: "/databases/postgresql/overview" diff --git a/src/_posts/databases/mysql/2000-01-01-changing-plan.md b/src/_posts/databases/mysql/2000-01-01-changing-plan.md new file mode 100644 index 000000000..57911a928 --- /dev/null +++ b/src/_posts/databases/mysql/2000-01-01-changing-plan.md @@ -0,0 +1,147 @@ +--- +title: Changing Plan +nav: Changing Plan +modified_at: 2025-03-31 12:00:00 +tags: databases mysql addon +index: 7 +--- + +At Scalingo, all databases addons plans are identified using a name made of two +or three parts separated by a dash (-). This name is made of: + +1. a database ***type*** : `mysql` +2. a ***class*** : either `sandbox`, `starter` or `business` (learn more about + [classes]({% post_url databases/2000-01-01-overview %}#database-plans)) +3. a ***size*** : specifying the amount of RAM available with the plan, in MB + (only for starter and business classes). + +You can change your Scalingo for MySQL® addon plan whenever you want. The +operation is launched instantly, no manual input is required. + +The impact on your application and the downtime vary depending on several +factors such as the current plan being used and the one you wish to change for +(see below for further information). + +{% warning %} +While switching to a more powerful plan is rather safe, you should take extra +care when changing for a less powerful plan: please make sure the new plan can +handle all your data and fits your application workload. +{% endwarning %} + + +## Understanding the Plan Change Process + +### From Starter to Starter + +When changing the size of a Starter plan, the platform reboots the existing +instance with the new size. This leads to a small service interruption +during which the database is not available. This shouldn't exceed a few seconds +though. + +| From (class) | To (class) | To (size) | Downtime | Duration | +| ------------ | ---------- | --------- | -------- | ------------ | +| Starter | Starter | Any | **Yes** | 2-10 seconds | + +### From Starter to Business + +When changing for a Business plan, the platform starts additional instances +with the targeted size. If necessary, it then reboots the previously existing +instance with the targeted size. There should be no downtime at all, thanks to +the failover mechanism included with the Business plan. + +| From (class) | To (class) | To (size) | Downtime | Duration | +| ------------ | ---------- | --------- | -------- | ------------ | +| Starter | Business | Any | **No** | Zero | + +### From Business to Starter + +When changing for a lower class, the platform first powers the surplus +instances off. When necessary, the remaining instance is rebooted with the +targeted new size. This can lead to a small service interruption during which +the database is not available. This shouldn't exceed a few seconds though. + +| From (class) | To (class) | To (size) | Downtime | Duration | +| ------------ | ---------- | --------- | -------- | ------------ | +| Business | Starter | Same | **No** | Zero | +| Business | Starter | Larger | **Yes** | 2-10 seconds | +| Business | Starter | Smaller | **Yes** | 2-10 seconds | + +### From Business to Business + +When changing the size of a Business plan, the platform reboots the instances +with the targeted new size one by one. There's no downtime during this +operation, thanks to the high availability mechanism included in the Business +plan. + +| From (class) | To (class) | To (size) | Downtime | Duration | +| ------------ | ---------- | --------- | -------- | ------------ | +| Business | Business | Any | **No** | Zero | + + +## Using the Dashboard + +1. From your web browser, open your [dashboard](https://dashboard.scalingo.com/apps) +2. Click on the application for which you want to scale the Scalingo for + MySQL® addon +3. Click on the **Resources** tab +4. Locate the **Addons** block and click on the **"…"** button +5. From the dropdown menu, select **Change plan** +6. Select the new plan +7. Click the **Finish** button +8. Validate by clicking the **Confirm plan change** button + + +## Using the Database Dashboard + +1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-mysql-dashboard) +2. Click the **Settings** tab +3. In **General**, locate the **Database Plan** block +4. In this block, click the **Change plan** button +5. Select the new plan +6. Click the **Finish** button +7. Validate by clicking the **Confirm plan change** button + + +## Using the Command Line + +1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) +2. From the command line, list the plans available for `mysql`: + ```bash + scalingo addons-plans mysql + ``` + The output should look like this: + ```text + +-----------------------+---------------+ + | ID | NAME | + +-----------------------+---------------+ + | mysql-sandbox | Sandbox | + | mysql-starter-512 | Starter 512M | + | mysql-starter-1024 | Starter 1G | + ... + ``` +3. Locate the `ID` corresponding to the plan you want to scale to (for example + `mysql-business-1024`) +4. Change plan using the `addons-upgrade` sub-command: + ```bash + scalingo --app my-app addons-upgrade mysql + ``` + The output should look like this: + ```text + -----> Addon ad-d0aa540a-5ed2-41f8-8bbe-91e3aff6623b has been upgraded + Message from addon provider: Database plan is being changed + ``` + + +## Using the Terraform Provider + +1. Update the `plan` property of the corresponding Resource block in your + Terraform file to scale the addon: + ```tf + resource "scalingo_addon" "my-db" { + provider_id = "mysql" + plan = "mysql-business-1024" + app = "${scalingo_app.my-app.id}" + } + ``` + In this example, we switch the `my-db` resource attached to the `my-app` + application to a MySQL® Business 1024 addon. diff --git a/src/_posts/databases/mysql/2000-01-01-getting-started.md b/src/_posts/databases/mysql/2000-01-01-getting-started.md index e5fa0e5f5..19ca01954 100644 --- a/src/_posts/databases/mysql/2000-01-01-getting-started.md +++ b/src/_posts/databases/mysql/2000-01-01-getting-started.md @@ -83,10 +83,10 @@ tasks such as: - [Monitoring the database]({% post_url databases/mysql/2000-01-01-monitoring %}) through logs, metrics and statistics -- [Upgrading the database]({% post_url databases/mysql/2000-01-01-managing %}#upgrading) +- [Upgrading the database]({% post_url databases/mysql/2000-01-01-upgrading %}) engine version -- [Managing database users]({% post_url databases/mysql/2000-01-01-managing %}#managing-users) -- [Managing databases]({% post_url databases/mysql/2000-01-01-managing %}#using-multiple-databases) +- [Managing database users]({% post_url databases/mysql/2000-01-01-managing-users %}) +- [Managing databases]({% post_url databases/mysql/2000-01-01-using-multiple-databases %}) - [Managing backups]({% post_url databases/mysql/2000-01-01-backing-up %}) You can access the database dashboard via the application dashboard: diff --git a/src/_posts/databases/mysql/2000-01-01-managing-users.md b/src/_posts/databases/mysql/2000-01-01-managing-users.md new file mode 100644 index 000000000..88ed864ad --- /dev/null +++ b/src/_posts/databases/mysql/2000-01-01-managing-users.md @@ -0,0 +1,181 @@ +--- +title: Managing Users of Your Scalingo for MySQL® Addon +nav: Managing Users +modified_at: 2025-03-31 12:00:00 +tags: databases mysql addon +index: 5 +--- + +Each Scalingo for MySQL® addon comes with a [default database user](#understanding-protected-user). +You can [create](#creating-a-new-user) as many additional users as needed, +grant them with the appropriate permissions, and you can [delete](#deleting-a-user) +them once they are not required anymore. + + +## Listing Existing Users + +### Understanding Protected User + +When provisioning a new Scalingo for MySQL® addon, the platform creates a +default user with a random name and password. It also grants this default user +read and write permissions on the database, using the following queries: + +```sql +GRANT ALL PRIVILEGES ON .* TO ''@'%%' +``` + +{% note %} +This default user is ***protected*** and thus: +- can't be renamed, nor removed, +- its password can't be updated +{% endnote %} + +### Using the Database Dashboard + +1. From your web browser, open your [database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-mysql-dashboard) +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Users** +4. The list of available users is displayed under the **User Management** + section + +### Using the Command Line + +1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) +2. From the command line, run the following command to list the users: + ```bash + scalingo --app my-app --addon mysql database-users-list + ``` + The output should look like this: + ```text + +----------------+-----------+-----------+ + | USERNAME | READ-ONLY | PROTECTED | + +----------------+-----------+-----------+ + | my_app_4553 | false | true | + | my_app_4553_rw | false | false | + | my_app_4553_ro | true | false | + +----------------+-----------+-----------+ + ``` + In this example, we can see that the database has 3 users available. One has + been created along with the addon and is protected, which means it can't be + removed. Among the two others, one can only read data from the database. + + +## Creating a New User + +{% note %} +The following restrictions apply when creating a new user, regardless of the +method you use: + +- Username **must**: + - Start with a letter + - Be between 6 and 16 characters long + - Contain only alphanumerical characters and underscores (`_`) +- Password **must**: + - Be between 24 and 64 characters long. + - Not contain the character `"` or `'` +{% endnote %} + +### Using the Database Dashboard + +1. From your web browser, open your [database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-mysql-dashboard) +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Users** +4. Click the **Add a user** button +5. Fill the **Add a new user** form: + - Fill a username + - To grant write abilities to this user, make sure to check the **Write + (optional)** checkbox +6. Validate by clicking the **Add this user** button +7. A secure password is generated automatically and shown in a popup window + after the user creation. **You will be able to view and copy it only once**. + +### Using the Command Line + +1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) +2. From the command line, run the following command to create a new user: + ```bash + scalingo --app my-app --addon mysql database-users-create + ``` + Optionally, if you want to restrict this user to read only abilities, use + the `--read-only` flag: + ```bash + scalingo --app my-app --addon mysql database-users-create --read-only + ``` +3. Set the user password: + - Either chose a password and confirm it + - Or let the platform generate a password by leaving the field empty + + The output should look like this: + - If you set a password: + ```text + User "my_user" created. + ``` + - If you let the platform generate a password: + ```text + User "my_user" created with password "YANs3y07m5_KJC2MSDGebh8tx1lliFWh2Yb239zVqGQvbElWDjIN7QWspVH92Ul8". + ``` + +## Updating a User Password + +{% note %} +- Setting a user password to a **specific value** can only be done via the + command line. +- Please get in touch with our Support Team to update a + [protected user](#understanding-protected-user) password. +{% endnote %} + +### Using the Database Dashboard + +1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-mysql-dashboard) +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Users** +4. Locate the user you want the password to be updated +5. Click the **"…"** button next to the user +6. From the popup menu, select **Reset password** +7. In the popup window, confirm the reset by typing the name of the user +8. Validate by clicking the **Confirm** button +9. A secure password is generated automatically and shown in a popup window + after the password reset. **You will be able to view and copy it only + once**. + +### Using the Command Line + +1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) +2. Update the user password with the following command: + ```bash + scalingo --app my-app --addon mysql database-users-update-password + ``` +3. An interactive prompt asks you for a password you want to attribute to your user: + - Either choose a password and confirm it + - Or let the platform generate a password by leaving the field empty + The output should look like this: + - If you set a password: + ```text + User "my_user" created. + ``` + - If you let the platform generate a password: + ```text + User "my_user" created with password "YANs3y07m5_KJC2MSDGebh8tx1lliFWh2Yb239zVqGQvbElWDjIN7QWspVH92Ul8". + ``` + + +## Deleting a User + +### Using the Database Dashboard + +1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-mysql-dashboard) +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Users** +4. Locate the user you want to remove +5. Click the **"…"** button next to the user +6. From the popup menu, select **Delete user** +7. In the popup window, confirm the deletion by typing the name of the user +8. Validate by clicking the **Confirm** button + +### Using the Command Line + +1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) +2. Remove the user with the following command: + ```bash + scalingo --app my-app --addon mysql database-users-delete + ``` diff --git a/src/_posts/databases/mysql/2000-01-01-managing.md b/src/_posts/databases/mysql/2000-01-01-managing.md deleted file mode 100644 index 24a05c0b1..000000000 --- a/src/_posts/databases/mysql/2000-01-01-managing.md +++ /dev/null @@ -1,450 +0,0 @@ ---- -title: Managing Your Scalingo for MySQL® Addon -nav: Managing -modified_at: 2024-10-24 12:00:00 -tags: databases mysql addon -index: 5 ---- - - -## Scaling (Changing Plan) - -You can change your database plan whenever you want. This operation happens -instantly, no manual input is required. When you change the plan, the instances -of your database are stopped and then restarted with the characteristics of the -chosen plan. According to the type of plan you are originally using, the impact -on your application differs: -- **Starter Plans**: Since these plans are not highly available, expect some - unavailability during which the scale operations are conducted. The duration - highly depends on the database size (from seconds to several hours). -- **Business Plans**: Thanks to high availability, only a failover occurs - during the operation. Current connections are stopped and the application has - to reconnect. It can be transparent or lead to a ~2-5 seconds interruption, - depending on the driver used by your application and its configuration. - -{% note %} - Business Plans are only available starting with MySQL® 8.\ - Consider [upgrading to MySQL® 8](#upgrading-to-mysql-8) if you want to - benefit from high availability with MySQL®. -{% endnote %} - -In both cases, once the operation is finished, the application is restarted to -ensure it creates new healthy connections to the database. - -{% warning %} -While upscaling (changing for a more powerful plan) is rather safe, you should -take extra care when downscaling: please make sure the new plan can handle all -your data and fits your application workload. -{% endwarning %} - -### Using the Dashboard - -1. From your web browser, open your [dashboard](https://dashboard.scalingo.com/apps) -2. Click on the application for which you want to scale the Scalingo for - MySQL® addon -3. Click on the **Resources** tab -4. Locate the **Addons** block and click on the **"…"** button -5. From the dropdown menu, select **Change plan** -6. Select the new plan -7. Click the **Finish** button -8. Validate by clicking the **Confirm plan change** button - -### Using the Database Dashboard - -1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-scalingo-for-mysql-dashboard) -2. Click the **Settings** tab -3. In **General**, select **Change plan** -4. Select the new plan -5. Click the **Finish** button -6. Validate by clicking the **Confirm plan change** button - -### Using the Command Line - -1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) -2. From the command line, list the plans available for `mysql`: - ```bash - scalingo addons-plans mysql - ``` - The output should look like this: - ```text - +-----------------------+---------------+ - | ID | NAME | - +-----------------------+---------------+ - | mysql-sandbox | Sandbox | - | mysql-starter-512 | Starter 512M | - | mysql-starter-1024 | Starter 1G | - ... - ``` -3. Locate the `ID` corresponding to the plan you want to scale to (for example - `mysql-business-1024`) -4. List the addons attached to your application: - ```bash - scalingo --app my-app addons - ``` - The output should look like this: - ```text - +-------+-----------------------------------------+-------------------+---------+ - | ADDON | ID | PLAN | STATUS | - +-------+-----------------------------------------+-------------------+---------+ - | MySQL | ad-871546ad-943a-4929-9770-ec7c839d65f5 | mysql-starter-512 | running | - ... - ``` -5. Locate the `ID` corresponding to the addon you want to scale -6. Change plan using the `addons-upgrade` sub-command: - ```bash - scalingo --app my-app addons-upgrade - ``` - The output should look like this: - ```text - -----> Addon ad-d0aa540a-5ed2-41f8-8bbe-91e3aff6623b has been upgraded - Message from addon provider: Database plan is being changed - ``` - -### Using the Terraform Provider - -1. Update the `plan` property of the corresponding Resource block in your - Terraform file to scale the addon: - ```tf - resource "scalingo_addon" "my-db" { - provider_id = "mysql" - plan = "mysql-business-1024" - app = "${scalingo_app.my-app.id}" - } - ``` - In this example, we switch the `my-db` resource attached to the `my-app` - application to a MySQL® Business 1024 addon. -2. Run `terraform plan` and check if the result looks good -3. If so, run `terraform apply` - - -## Upgrading - -Upgrading your MySQL® addon consists in changing the database version for -a newer one. - -When the database vendor releases a new version of your database engine, we -take some time to study it and test it thoroughly before making it available. -Upgrading to this new version is still your choice. We don't do it -automatically. - -{% warning %} -Beware that no downgrade is possible once your database has been upgraded. -{% endwarning %} - -Your database needs to be upgraded to the latest minor version before having -access to the next major version. For instance, let's imagine that your version -is `2.3.x` and you want to upgrade to `3.1.x`. If there is a `2.5.x` version -available, you first need to upgrade your database to the `2.5.x` version -before upgrading to the `3.1.x` version. - -During the upgrade, a downtime can unfortunately happen, depending on the Plan -you are using and the upgrade: -- **Starter Plans**: In all cases, we have to stop the node to upgrade it, - causing an inevitable downtime. -- **Business Plans**: We are able to achieve zero-downtime upgrade of - minor version. In the case of major version upgrade, we need to completely - stop the nodes, hence causing an inevitable downtime. - -In both cases, once the operation is finished, the application is restarted. - -{% note %} -There are a couple more prerequisites when upgrading from MySQL® 5.7 to 8.0. -Please make sure to check [these mandatory prerequisites]({% post_url databases/mysql/2000-01-01-mysql-8-prerequisites %}).\ -Upgrading to MySQL® 8.0 is mandatory to benefit from MySQL® high availability via -Business Plans. -{% endnote %} - -### Using the Database Dashboard - -1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-scalingo-for-mysql-dashboard) -2. Select the **Settings** tab -3. In the **Settings** submenu, select the **General** tab -4. Locate the **Database Version** block -5. If an upgrade is available, a button allows you to trigger the upgrade -6. Click the button to launch the upgrade process - -{% note %} -Upgrading a MySQL® addon to a newer version is only available through the -database dashboard. -{% endnote %} - - -## Managing Users - -By default, Scalingo creates a user with read and write permissions on your -database with the following queries: - -```sql -GRANT ALL PRIVILEGES ON .* TO ''@'%' -``` - -{% note %} -It is not possible to delete a protected user or change their password. -{% endnote %} - -### Listing Users - -#### Using the Database Dashboard - -1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-scalingo-for-mysql-dashboard) -2. Click the **Settings** tab -3. In the **Settings** submenu, select **Users** -4. The list of available users is displayed in the **User Management** block - -#### Using the Command Line - -1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) -2. From the command line, run the following command to list the users: - ```bash - scalingo --app my-app --addon mysql database-users-list - ``` - The output should look like this: - ```text - +----------------+-----------+-----------+ - | USERNAME | READ-ONLY | PROTECTED | - +----------------+-----------+-----------+ - | my_app_4553 | false | true | - | my_app_4553_rw | false | false | - | my_app_4553_ro | true | false | - +----------------+-----------+-----------+ - ``` - In this example, we can see that the database has 3 users available. One has - been created along with the addon and is protected, which means it can't be - removed. Among the two others, one can only read data from the database. - -### Creating a New User - -The following restrictions apply when creating a new user, regardless of the -method you use: - -- Username: - - Must be between 6 and 16 characters long - - Can only contain alphanumerical characters and underscores (`_`) - - Must start with a letter -- Password: - - Must be between 24 and 64 characters long. - - Must not contain the character `"` or `'` - -#### Using the Database Dashboard - -{% note %} -If you want to define a user password, this can only be done via the command line. -{% endnote %} - -1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-scalingo-for-mysql-dashboard) -2. Click the **Settings** tab -3. In the **Settings** submenu, select **Users** -4. Fill the **Add a user** form: - - Fill a username - - To grant write abilities to this user, make sure to check the **Write (optional)** checkbox -5. Validate by clicking the **Add this user** button - -{% note %} -A secure password is generated automatically and shown in a popup window after the user creation. -You will be able to view and copy it only once. -{% endnote %} - -#### Using the Command Line - -1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) -2. From the command line, run the following command to create a new user: - ```bash - scalingo --app my-app --addon mysql database-users-create - ``` - Optionally, if you want to restrict this user to read only abilities, use - the `--read-only` flag: - ```bash - scalingo --app my-app --addon mysql database-users-create --read-only - ``` -3. Set the user password: - - Either chose a password and confirm it - - Or let the platform generate a password by leaving the field empty - - The output should look like this: - - If you set a password: - ```text - User "my_user" created. - ``` - - If you let the platform generate a password: - ```text - User "my_user" created with password "YANs3y07m5_KJC2MSDGebh8tx1lliFWh2Yb239zVqGQvbElWDjIN7QWspVH92Ul8". - ``` - -### Updating a User Password - -#### Using the Database Dashboard - -{% note %} -If you want to define a user password, this can only be done via the command line. -{% endnote %} - -1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-scalingo-for-mysql-dashboard) -2. Click the **Settings** tab -3. In the **Settings** submenu, select **Users** -4. Locate the user you want the password to be updated -5. Click the **"…"** button next to the user -6. From the popup menu, select **Reset password** -7. In the popup window, confirm the reset by typing the name of the user -8. Validate by clicking the **Confirm** button - -{% note %} -A secure password is generated automatically and shown in a popup window after the password reset. -You will be able to view and copy it only once. -{% endnote %} - -#### Using the Command Line - -1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) -2. Update the user password with the following command: - ```bash - scalingo --app my-app --addon mysql database-users-update-password - ``` -3. An interactive prompt asks you for a password you want to attribute to your user: - - Either choose a password and confirm it - - Or let the platform generate a password by leaving the field empty - The output should look like this: - - If you set a password: - ```text - User "my_user" created. - ``` - - If you let the platform generate a password: - ```text - User "my_user" created with password "YANs3y07m5_KJC2MSDGebh8tx1lliFWh2Yb239zVqGQvbElWDjIN7QWspVH92Ul8". - ``` - -### Updating the Default User Password - -To change the default user password, contact support as this can only be done by the Scalingo team. - -{% note %} -The default user is created along with the addon and included in the default environment variable `SCALINGO_MYSQL_URL`. -{% endnote %} - -### Deleting an Existing User - -#### Using the Database Dashboard - -1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-scalingo-for-mysql-dashboard) -2. Click the **Settings** tab -3. In the **Settings** submenu, select **Users** -4. Locate the user you want to remove -5. Click the **"…"** button next to the user -6. From the popup menu, select **Delete user** -7. In the popup window, confirm the deletion by typing the name of the user -8. Validate by clicking the **Confirm** button - -#### Using the Command Line - -1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) -2. Remove the user with the following command: - ```bash - scalingo --app my-app --addon mysql database-users-delete - ``` - -## Using Multiple Databases - -Each Scalingo for MySQL® addon comes with a default database. You can, however, -create multiple databases on the same Scalingo for MySQL® instance. In this -case: -- The memory and disk storage allocated in the plan are shared between all - databases -- By default, the database users (the default one and the ones you could have - created) are shared between databases, even for existing ones -- All databases are [backed up]({% post_url databases/mysql/2000-01-01-backing-up %}) - in the same backup file -- The platform doesn't provide any environment variable for this new database. - You should, however, be able to generate one from the original - `SCALINGO_MYSQL_URL`. - -### Listing Existing Databases - -#### Using the Database Dashboard - -1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-scalingo-for-mysql-dashboard) -2. Click the **Settings** tab -3. In the **Settings** submenu, select **Databases** - -{% note %} -Listing existing databases is only available from the Database Dashboard. -{% endnote %} - -### Creating a New Database - -#### Using the Database Dashboard - -1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-scalingo-for-mysql-dashboard) -2. Click the **Settings** tab -3. In the **Settings** submenu, select **Databases** -4. Fill the **Add a database** form by specifying a **name** for the new - database -5. Validate the form by clicking the **Create this database** button - -{% note %} -Creating a new database is only available from the Database Dashboard. -{% endnote %} - -### Deleting a Database - -{% note %} -The default database can not be deleted. It can only be emptied. -{% endnote %} - -{% warning %} -Consider [creating a backup]({% post_url databases/mysql/2000-01-01-backing-up %}#creating-a-manual-backup) -prior to deleting a database. -{% endwarning%} - -#### Using the Database Dashboard - -1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-scalingo-for-mysql-dashboard) -2. Click the **Settings** tab -3. In the **Settings** submenu, select **Databases** -4. Locate the database you want to remove -5. Click the **"…"** button next to the database -6. From the popup menu, select **Drop** -7. In the popup window, confirm the deletion by typing the name of the database -8. Validate by clicking the **Confirm** button - -{% note %} -Deleting a database is only available from the Database Dashboard. -{% endnote %} - - -## Working with SQL Modes - -SQL modes allow you to configure MySQL® to behave according to specific -standards, adjusting how it processes queries and verifies data validity. This -includes settings that can make MySQL® more strict or more flexible regarding -SQL syntax and data constraints, providing developers the ability to optimize -database performances based on their application's requirements. - -Scalingo doesn't moderate the modes available, which means all modes supported -by your addon are indeed available. The exhaustive list may vary depending on -your MySQL® version. Descriptions of the modes can be found in the official -MySQL® documentation: - -- [for MySQL® `5.7` `EOL`](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html) -- [for MySQL® `8.0`](https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html) - -Currently, the default SQL mode includes: `ONLY_FULL_GROUP_BY`, -`STRICT_TRANS_TABLES`, `NO_ZERO_IN_DATE`, `NO_ZERO_DATE`, -`ERROR_FOR_DIVISION_BY_ZERO`, and `NO_ENGINE_SUBSTITUTION`. - -### Setting SQL Modes - -#### Using the Database Dashboard - -1. From your web browser, open your [database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-mysql-dashboard) -2. Click the **Settings** tab -3. In the **Settings** submenu, select **Configuration** -4. Click the **Manage SQL modes** button -5. Select the mode(s) you are interested in -6. Validate by clicking the **Update configuration** button -7. The changes are done at runtime, which means they immediately apply to new - queries - -{% note %} -Setting SQL modes is only available through the database dashboard. MySQL® -users provided by the platform do not have the necessary permissions to perform -these actions via the MySQL® console. -{% endnote %} diff --git a/src/_posts/databases/mysql/2000-01-01-troubleshooting.md b/src/_posts/databases/mysql/2000-01-01-troubleshooting.md index 200f5e78d..0dafa8727 100644 --- a/src/_posts/databases/mysql/2000-01-01-troubleshooting.md +++ b/src/_posts/databases/mysql/2000-01-01-troubleshooting.md @@ -27,7 +27,7 @@ memory pages to disk, leading to performance degradation and increased latency. As a consequence, the size of the Buffer Pool should ideally be large enough to handle the database workload, thus preventing swap usage. A constantly swapping database could indicate that the space dedicated to the Buffer Pool has become -insufficient. In such a case, [switching to a superior plan]({% post_url databases/mysql/2000-01-01-managing %}#scaling-changing-plan) +insufficient. In such a case, [switching to a superior plan]({% post_url databases/mysql/2000-01-01-changing-plan %}) should quickly resolve the swapping issue. For further details about how MySQL® manages memory, please refer to [the diff --git a/src/_posts/databases/mysql/2000-01-01-upgrading.md b/src/_posts/databases/mysql/2000-01-01-upgrading.md new file mode 100644 index 000000000..36e8213d3 --- /dev/null +++ b/src/_posts/databases/mysql/2000-01-01-upgrading.md @@ -0,0 +1,154 @@ +--- +title: Upgrading Your Scalingo for MySQL® Addon +nav: Upgrading +modified_at: 2025-04-22 12:00:00 +tags: databases mysql addon +index: 8 +--- + +In Scalingo's terminology, ***upgrading*** a Scalingo for MySQL® addon +designates the operation consisting in changing the database version for a +newer one. + +**Currently**, Scalingo only supports the `8.0.x` branch of MySQL® Community +Edition, meaning the only upgrades available are ***patch-upgrades***. + +As explained in [the official documentation](https://dev.mysql.com/blog-archive/introducing-mysql-innovation-and-long-term-support-lts-versions/), +and starting with MySQL® `8.0.34`, the patch-upgrades only contain bug and +security fixes. Consequently, it should be rather safe to upgrade to a new +`8.0.x` version. + +While we usually advise to stick to the latest patch-upgrade available to +benefit from bug and security fixes, we also strongly advise to take extra-care +when upgrading your Scalingo for MySQL® addon ([more about this below](#best-practices-before-upgrading)). + +{% warning %} +Beware that no downgrade is possible once your database has been upgraded. +{% endwarning %} + + +## Understanding the Patch-Upgrade Process + +### Prerequisites + +There are no prerequisites for patch-upgrades. + +### Process + +#### For Starter Plans + +1. The instance is stopped. The database is unreachable. +2. The instance is restarted with the targeted version. This operation can take + quite some time depending on the database size. +3. Once the instance is restarted, the database is reachable again. +4. The application to which the database is attached is restarted to ensure + proper connections. [This does not cause any additional downtime]({% post_url platform/internals/2000-01-01-container-management %}#zero-downtime-operations). + +Since we have to completely stop the instance, **a downtime is inevitable**. + +#### For Business Plans + +1. The Scalingo for MySQL® Routers of the cluster are restarted one by one with + the targeted version. This shouldn't cause any downtime. +2. The different instances forming the cluster are restarted one by one. This + shouldn't cause any downtime, thanks to the MySQL® Routers routing the + connexions to the available instances. +3. Once all the nodes are restarted, the cluster is fully upgraded and fully + operational again. +4. The application to which the database is attached is restarted to ensure + proper connections. [This does not cause any additional downtime]({% post_url platform/internals/2000-01-01-container-management %}#zero-downtime-operations). + +Patch-upgrades of Business plans are **usually achieved without any impactful +downtime**. + +### Best Practices Before Upgrading + +- First, carefully read the changelogs provided by MySQL® (we usually link them + in our respective changelog entries). Identifying noticeable changes, + especially ones that may have a negative impact on your database or app, will + allow you to update your application accordingly. + +- We also generally advise to test the changes in a [Review App]({% post_url platform/app/2000-01-01-review-apps %}). + + The use of Review Apps can be deactivated on your production application, [as + we recommend]({% post_url platform/app/2000-01-01-review-apps %}#configuration-of-review-apps) + in our documentation. In general, it is recommended that you carry out this + process on a staging application using the same code repository, but linked + to a database with no production or customer data. Once you have activated + the Review Apps feature, you can create a pull request in which you can + modify the `scalingo.json` manifest file to force the deployment of a + specific version of MySQL®. The full process is as follow: + + 1. Create a new app dedicated to this upgrade. + 2. Link this app to your application's code repository. + 3. Make sure to enable Review Apps for this application. + 4. Leverage the [`scalingo.json` manifest file]({% post_url platform/app/2000-01-01-app-manifest %}) + to: + - Specify the version of the database addon you require. This version + should match the one you are using in your production environment. + - Ideally ask the platform to fill your database with **testing data**, + using a [`first-deploy` script]({% post_url platform/app/2000-01-01-app-manifest %}#deployment-hooks). + + Here is an example of a manifest file asking the platform to provision a + MySQL® `8.0.38` addon and to run the `db-seed.sh` script after the + first deployment (the script must be included in your codebase): + ```json + { + "addons": [ + { + "plan": "mysql:mysql-starter-512", + "options": { + "version": "8.0.38" + } + } + ], + + "env": { + "CANONICAL_HOST_URL": { + "generator": "url" + } + }, + + "scripts": { + "first-deploy": "bash -c db-seed.sh" + } + } + ``` + 5. Create a new Pull Request from the repository hosting your application's + code. A new Review App is created with the appropriate database version. + If you have a `first-deploy` script in your `scalingo.json` manifest, it's + executed. + 6. (optional): If you couldn't use a `first-deploy` script, it's now + time to fill your database with your test dataset. + 7. Once filled with testing data, upgrade your database until it reaches the + targeted version. + 8. Execute your tests scenarios on the Review App. This should help you + validate the changes, or identify the required fixes before sending them + to production. + 9. Once done, close the Pull Request to automatically destroy the linked + Review App. You can now plan the production upgrade. + +- [Create a manual backup]({% post_url databases/mysql/2000-01-01-backing-up %}#creating-a-manual-backup) + of your current production database just before making the move in your + production environment. + +- [Put the app in maintenance mode]({% post_url platform/app/2000-01-01-custom-error-page %}#custom-maintenance-page) + during the upgrade operations, especially if a significant downtime is + expected. + + +## Upgrading + +{% note %} +Upgrading a Scalingo for MySQL® addon to a newer version is only available +through the database dashboard. +{% endnote %} + +### Using the Database Dashboard + +1. From your web browser, open your [database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-mysql-dashboard) +2. Select the **Settings** tab +3. In the **Settings** submenu, select the **General** tab +4. Locate the **Database Version** block +5. If an upgrade is available, a button allows you to trigger the upgrade +6. Click the button to launch the upgrade process diff --git a/src/_posts/databases/mysql/2000-01-01-using-multiple-databases.md b/src/_posts/databases/mysql/2000-01-01-using-multiple-databases.md new file mode 100644 index 000000000..800549841 --- /dev/null +++ b/src/_posts/databases/mysql/2000-01-01-using-multiple-databases.md @@ -0,0 +1,92 @@ +--- +title: Using Multiple Databases +nav: Using Multiple Databases +modified_at: 2025-03-31 12:00:00 +tags: databases mysql addon +index: 12 +--- + + +Each Scalingo for MySQL® addon comes with a default database. You can, however, +create multiple databases on the same Scalingo for MySQL® instance. In this +case: +- The memory and disk storage allocated in the plan are shared between all + databases +- By default, the database users (the default one and the ones you could have + created) are shared between databases, even for existing ones +- All databases are [backed up]({% post_url databases/mysql/2000-01-01-backing-up %}) + in the same backup file +- The platform doesn't provide any environment variable for these additional + databases. You should, however, be able to generate one from the original + `SCALINGO_MYSQL_URL`. + + +## Listing Existing Databases + +### Using the Database Dashboard + +1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-mysql-dashboard) +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Databases** + +### Using the Command Line Tool + +1. Access your database using the [Interactive Remote Console]({% post_url databases/mysql/2000-01-01-accessing %}#using-the-interactive-remote-console) +2. From the MySQL® console, run the following command: + ```sql + SHOW DATABASES; + ``` + The ouput should look like this: + ``` + mysql> SHOW DATABASES; + +--------------------+ + | Database | + +--------------------+ + | my_app_5432 | + | my_database01 | + | my_database02 | + | information_schema | + | performance_schema | + +--------------------+ + 5 rows in set (0.01 sec) + ``` + + +## Creating a New Database + +{% note %} +Creating a new database is only available from the Database Dashboard. +{% endnote %} + +### Using the Database Dashboard + +1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-mysql-dashboard) +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Databases** +4. Fill the **Add a database** form by specifying a **name** for the new + database +5. Validate the form by clicking the **Create this database** button + + +## Deleting a Database + +{% note %} +- The default database can not be deleted. It can only be emptied. +- Deleting a database is only available from the Database Dashboard. +{% endnote %} + +{% warning %} +Consider [creating a backup]({% post_url databases/mysql/2000-01-01-backing-up %}#creating-a-manual-backup) +prior to deleting a database. +{% endwarning%} + +### Using the Database Dashboard + +1. From your web browser, [open your database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-mysql-dashboard) +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Databases** +4. Locate the database you want to remove +5. Click the **"…"** button next to the database +6. From the popup menu, select **Drop** +7. In the popup window, confirm the deletion by typing the name of the database +8. Validate by clicking the **Confirm** button diff --git a/src/_posts/databases/mysql/2000-01-01-working-with-sql-modes.md b/src/_posts/databases/mysql/2000-01-01-working-with-sql-modes.md new file mode 100644 index 000000000..ab20c755d --- /dev/null +++ b/src/_posts/databases/mysql/2000-01-01-working-with-sql-modes.md @@ -0,0 +1,49 @@ +--- +title: Working with SQL Modes +nav: Working with SQL Modes +modified_at: 2025-03-31 12:00:00 +tags: databases mysql addon modes +index: 13 +--- + + +SQL modes allow you to configure MySQL® to behave according to specific +standards, adjusting how it processes queries and verifies data validity. This +includes settings that can make MySQL® more strict or more flexible regarding +SQL syntax and data constraints, providing developers the ability to optimize +database performances based on their application's requirements. + +Scalingo doesn't moderate the modes available, which means all modes supported +by your addon are indeed available. The exhaustive list may vary depending on +your MySQL® version. Descriptions of the modes can be found in the official +MySQL® documentation: + +- [for MySQL® `8.0`](https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html) + +Currently, the default SQL mode includes: +- `ONLY_FULL_GROUP_BY` +- `STRICT_TRANS_TABLES` +- `NO_ZERO_IN_DATE` +- `NO_ZERO_DATE` +- `ERROR_FOR_DIVISION_BY_ZERO` +- `NO_ENGINE_SUBSTITUTION` + + +## Setting SQL Modes + +{% note %} +Setting SQL modes is only available through the database dashboard. MySQL® +users provided by the platform do not have the necessary permissions to perform +these actions via the MySQL® console. +{% endnote %} + +### Using the Database Dashboard + +1. From your web browser, open your [database dashboard]({% post_url databases/mysql/2000-01-01-getting-started %}#accessing-the-mysql-dashboard) +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Configuration** +4. Click the **Manage SQL modes** button +5. Select the mode(s) you are interested in +6. Validate by clicking the **Update configuration** button +7. The changes are done at runtime, which means they immediately apply to new + queries diff --git a/src/_posts/databases/postgresql/2000-01-01-changing-plan.md b/src/_posts/databases/postgresql/2000-01-01-changing-plan.md index 27cb50cbc..1a3fa3d9e 100644 --- a/src/_posts/databases/postgresql/2000-01-01-changing-plan.md +++ b/src/_posts/databases/postgresql/2000-01-01-changing-plan.md @@ -92,6 +92,17 @@ operation, thanks to the failover mechanism included in the Business plan. 8. Validate by clicking the **Confirm plan change** button +## Using the Database Dashboard + +1. From your web browser, [open your database dashboard]({% post_url databases/postgresql/2000-01-01-getting-started %}#accessing-the-postgresql-dashboard) +2. Click the **Settings** tab +3. In **General**, locate the **Database Plan** block +4. In this block, click the **Change plan** button +5. Select the new plan +6. Click the **Finish** button +7. Validate by clicking the **Confirm plan change** button + + ## Using the Command Line 1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) @@ -134,6 +145,4 @@ operation, thanks to the failover mechanism included in the Business plan. } ``` In this example, we switch the `my-db` resource attached to the `my-app` - application to a PostgreSQL Business 1024 addon. -2. Run `terraform plan` and check if the result looks good -3. If so, run `terraform apply` + application to a PostgreSQL® Business 1024 addon. diff --git a/src/_posts/databases/postgresql/2000-01-01-managing-users.md b/src/_posts/databases/postgresql/2000-01-01-managing-users.md index 9105db2e2..40cb30dd7 100644 --- a/src/_posts/databases/postgresql/2000-01-01-managing-users.md +++ b/src/_posts/databases/postgresql/2000-01-01-managing-users.md @@ -38,8 +38,9 @@ This default user is ***protected*** and thus: ### Using the Database Dashboard 1. From your web browser, open your [database dashboard]({% post_url databases/postgresql/2000-01-01-getting-started %}#accessing-the-postgresql-dashboard) -2. Click the **Users** tab -3. The list of available users is displayed under the **User Management** +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Users** +4. The list of available users is displayed under the **User Management** section ### Using the Command Line @@ -81,13 +82,16 @@ method used: ### Using the Database Dashboard 1. From your web browser, open your [database dashboard]({% post_url databases/postgresql/2000-01-01-getting-started %}#accessing-the-scalingo-for-postgresql-dashboard) -2. Click the **Users** tab -3. Fill the **Add a new user** form: +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Users** +4. Click the **Add a user** button +5. Fill the **Add a new user** form: - Fill a username - - Fill the corresponding password twice -4. (optional) If you want to restrict this user to read only abilities, make - sure to check the **Read only** checkbox -5. Validate by clicking the **Add User** button + - To grant write abilities to this user, make sure to check the **Write + (optional** checkbox +6. Validate by clicking the **Add this user** button +7. A secure password is generated automatically and shown in a popup window + after the user creation. **You will be able to view and copy it only once**. ### Using the Command Line @@ -119,9 +123,26 @@ method used: ## Updating a User Password {% note %} -Updating a User Password is only available from the command line. +- Setting a user password to a **specific value** can only be done via the + command line. +- Please get in touch with our Support Team to update a + [protected user](#understanding-protected-user) password. {% endnote %} +### Using the Database Dashboard + +1. From your web browser, [open your database dashboard]({% post_url databases/postgresql/2000-01-01-getting-started %}#accessing-the-postgresql-dashboard) +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Users** +4. Locate the user you want the password to be updated +5. Click the **"…"** button next to the user +6. From the popup menu, select **Reset password** +7. In the popup window, confirm the reset by typing the name of the user +8. Validate by clicking the **Confirm** button +9. A secure password is generated automatically and shown in a popup window + after the password reset. **You will be able to view and copy it only + once**. + ### Using the Command Line 1. Make sure you have correctly [setup the Scalingo command line tool]({% post_url platform/cli/2000-01-01-start %}) @@ -148,10 +169,13 @@ Updating a User Password is only available from the command line. ### Using the Database Dashboard 1. From your web browser, open your [database dashboard]({% post_url databases/postgresql/2000-01-01-getting-started %}#accessing-the-scalingo-for-postgresql-dashboard) -2. Click the **Users** tab -3. Locate the user you want to remove -4. Click the **Delete** button next to the user -5. Confirm the removal +2. Click the **Settings** tab +3. In the **Settings** submenu, select **Users** +4. Locate the user you want to remove +5. Click the **"…"** button next to the user +6. From the popup menu, select **Delete user** +7. In the popup window, confirm the deletion by typing the name of the user +8. Validate by clicking the **Confirm** button ### Using the Command Line diff --git a/src/_posts/databases/postgresql/2000-01-01-upgrading.md b/src/_posts/databases/postgresql/2000-01-01-upgrading.md index 1ef7513bc..9ea50c854 100644 --- a/src/_posts/databases/postgresql/2000-01-01-upgrading.md +++ b/src/_posts/databases/postgresql/2000-01-01-upgrading.md @@ -228,8 +228,8 @@ database dashboard. ### Using the Database Dashboard 1. From your web browser, open your [database dashboard]({% post_url databases/postgresql/2000-01-01-getting-started %}#accessing-the-scalingo-for-postgresql-dashboard) -2. Click the **Overview** tab -3. Locate the **Database Upgrade** block -4. If an upgrade is available, the text in the block explains what will be - done. -5. To launch the upgrade, click the **Upgrade to …** button +2. Select the **Settings** tab +3. In the **Settings** submenu, select the **General** tab +4. Locate the **Database Version** block +5. If an upgrade is available, a button allows you to trigger the upgrade +6. Click the button to launch the upgrade process