|
| 1 | +# Clean up your installation |
| 2 | + |
| 3 | +If you want to remove Percona Server for MySQL and clean up your system, follow the steps below for your installation method. |
| 4 | + |
| 5 | +!!! warning |
| 6 | + |
| 7 | + These steps will remove Percona Server for MySQL and may delete all data files (databases, tables, logs, etc.). Take a backup before proceeding if you need to preserve any data. |
| 8 | + |
| 9 | +=== "Docker" |
| 10 | + |
| 11 | + If you installed Percona Server for MySQL using Docker, follow these steps: |
| 12 | + |
| 13 | + 1. Exit the MySQL command client shell if you're still connected: |
| 14 | + |
| 15 | + ```sql |
| 16 | + exit |
| 17 | + ``` |
| 18 | + |
| 19 | + You can also use `\q` or `quit` commands. The execution of the statement also closes the connection. |
| 20 | + |
| 21 | + 2. Stop and remove the Docker container: |
| 22 | + |
| 23 | + ```shell |
| 24 | + docker container rm psmysql -f |
| 25 | + ``` |
| 26 | + |
| 27 | + ??? example "Expected output" |
| 28 | + |
| 29 | + ```text |
| 30 | + psmysql |
| 31 | + ``` |
| 32 | + |
| 33 | + 3. Remove the Docker image: |
| 34 | + |
| 35 | + ```shell |
| 36 | + docker image rmi percona/percona-server:{{tag}} |
| 37 | + ``` |
| 38 | + |
| 39 | + If you are running the ARM64 version of Percona Server, use: |
| 40 | + |
| 41 | + ```shell |
| 42 | + docker image rmi percona/percona-server:{{arm_tag}} |
| 43 | + ``` |
| 44 | + |
| 45 | + ??? example "Expected output" |
| 46 | + |
| 47 | + ```text |
| 48 | + Untagged: percona/percona-server:{{tag}} |
| 49 | + Untagged: percona/percona-server@sha256:4944f9b365e0dc88f41b3b704ff2a02d1459fd07763d7d1a444b263db8498e1f |
| 50 | + Deleted: sha256:b2588da614b1f382468fc9f44600863e324067a9cae57c204a30a2105d61d9d9 |
| 51 | + ... |
| 52 | + ``` |
| 53 | + |
| 54 | + 4. Remove the Docker volume (if you created one): |
| 55 | + |
| 56 | + ```shell |
| 57 | + docker volume rm myvol |
| 58 | + ``` |
| 59 | + |
| 60 | + ??? example "Expected output" |
| 61 | + |
| 62 | + ```text |
| 63 | + myvol |
| 64 | + ``` |
| 65 | + |
| 66 | +=== "YUM or DNF" |
| 67 | + |
| 68 | + If you installed Percona Server for MySQL using YUM or DNF on Oracle Linux or RHEL, follow these steps: |
| 69 | + |
| 70 | + 1. Stop the Percona Server for MySQL service: |
| 71 | + |
| 72 | + ```shell |
| 73 | + sudo systemctl stop mysql |
| 74 | + ``` |
| 75 | + |
| 76 | + 2. Remove the packages: |
| 77 | + |
| 78 | + ```shell |
| 79 | + sudo yum remove percona-server* |
| 80 | + ``` |
| 81 | + |
| 82 | + Or if you're using DNF: |
| 83 | + |
| 84 | + ```shell |
| 85 | + sudo dnf remove percona-server* |
| 86 | + ``` |
| 87 | + |
| 88 | + These commands remove the packages but leave data files behind. If you want to remove data files as well, continue to step 3. |
| 89 | + |
| 90 | + 3. [Optional] Remove data and configuration files: |
| 91 | + |
| 92 | + !!! warning |
| 93 | + |
| 94 | + This step permanently deletes all data files (databases, tables, logs, etc.). Ensure you have a backup if you need this data. |
| 95 | + |
| 96 | + ```shell |
| 97 | + sudo rm -rf /var/lib/mysql |
| 98 | + sudo rm -f /etc/my.cnf |
| 99 | + ``` |
| 100 | + |
| 101 | +=== "APT" |
| 102 | + |
| 103 | + If you installed Percona Server for MySQL using APT on Ubuntu or Debian, follow these steps: |
| 104 | + |
| 105 | + 1. Stop the Percona Server for MySQL service: |
| 106 | + |
| 107 | + ```shell |
| 108 | + sudo systemctl stop mysql |
| 109 | + ``` |
| 110 | + |
| 111 | + 2. Choose one of the following options: |
| 112 | + |
| 113 | + **Option A: Remove packages but keep data files** |
| 114 | + |
| 115 | + This command removes the packages but leaves data files (databases, tables, logs, configuration, etc.) behind: |
| 116 | + |
| 117 | + ```shell |
| 118 | + sudo apt remove percona-server* |
| 119 | + ``` |
| 120 | + |
| 121 | + **Option B: Remove packages and delete all data files** |
| 122 | + |
| 123 | + !!! warning |
| 124 | + |
| 125 | + This command removes all packages and permanently deletes all data files (databases, tables, logs, etc.). Ensure you have a backup if you need this data. |
| 126 | + |
| 127 | + ```shell |
| 128 | + sudo apt purge percona-server* |
| 129 | + ``` |
| 130 | + |
| 131 | + 3. [Optional] If you used Option A and want to remove data files manually: |
| 132 | + |
| 133 | + !!! warning |
| 134 | + |
| 135 | + This step permanently deletes all data files. Ensure you have a backup if you need this data. |
| 136 | + |
| 137 | + ```shell |
| 138 | + sudo rm -rf /var/lib/mysql |
| 139 | + sudo rm -f /etc/mysql/my.cnf |
| 140 | + ``` |
| 141 | + |
| 142 | +## Next steps |
| 143 | + |
| 144 | +[Next steps](quickstart-next-steps.md) |
| 145 | + |
| 146 | +## Additional references |
| 147 | + |
| 148 | +- [Quickstart - Overview](quickstart-overview.md) |
| 149 | +- [Run Percona Server for MySQL with Docker](quickstart-docker.md) |
| 150 | +- [Install Percona Server for MySQL on Ubuntu](quickstart-apt.md) |
| 151 | +- [Install Percona Server for MySQL on Oracle Linux](quickstart-yum.md) |
0 commit comments