Changing the MySQL root password on an Enhance server is straightforward with Docker. Follow these simple steps to securely update your password:

1- Stop the MariaDB Container

docker stop MariaDB

2- Start a Temporary MariaDB Container Use the same data directories to create a temporary MariaDB container. If you need to locate these directories, run:

docker inspect mariadb | grep -i mount -A 10

Then, start the temporary container with:

docker run -d --name mariadb_temp \
-v /var/local/enhance/mysql/ssl:/etc/mysql/ssl \
-v /etc/ssl/certs:/etc/ssl/certs \
-v /var/local/enhance/mysqlcd-data/data:/var/lib/mysql \
-v /var/local/enhance/mysqlcd-run:/var/run/mysqld \
-v /var/local/enhance/mysql/conf.d:/etc/mysql/conf.d \
--entrypoint "mysqld_safe" mariadb:lts --skip-grant-tables

3- Access the MySQL Shell Now, enter the MySQL shell to reset the root password:

docker exec -it mariadb_temp mysql -u root

4- Reset the Password In the MySQL shell, execute the following commands:

FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
EXIT;

5- Stop and Remove the Temporary Container After changing the password, stop and remove the temporary container:

docker stop mariadb_temp
docker rm mariadb_temp

6- Restart the Original MariaDB Container Finally, restart your original MariaDB container:

docker start mariadb

7- Verify the New Password Test your new root password with:

docker exec -it mariadb mysql -u root -p

By following these steps, you can easily update the MySQL root password on your Enhance server without disrupting your service.

No comment

Leave a Reply

Your email address will not be published. Required fields are marked *