Created
February 7, 2024 08:34
-
-
Save mklooss/c72fde5c2d6b847551a619471ba94519 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Take care of your versions, do not downgrade! | |
1. Create Docker Image first (see 01_z_docker.sh) | |
2. Stop Docker Instance (docker stop mariadb-103) | |
3. Check data directory (permissions ls -aln, keep in mind, sample "chown 999:999") | |
4. Set Permission to Root User, on System MySQL/Mariadb (see 02_mysql_root.sql), may u have to start with --skip-grant-tables | |
4. Stop System MySQL/MariaDB | |
5. Copy Data /var/lib/mysql to new place for Docker ( rsync --delete --progress --numeric-ids -axAhHPc /old/ /new/ ) | |
6. Chown /new/ Data to set the correct permission for the docker container | |
7. Start Both Container and System MariaDb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
docker stop mariadb-103 | |
docker rm mariadb-103 | |
docker pull mariadb:10.3 | |
docker stop mariadb-103 | |
docker run --name mariadb-103 \ | |
-v /opt/docker/mariadb-10.3/data:/var/lib/mysql \ | |
-v /opt/docker/mariadb-10.3/conf.d:/etc/mysql/conf.d \ | |
-v /tmpfs:/tmpfs \ | |
-v /etc/timezone:/etc/timezone:ro \ | |
-v /etc/localtime:/etc/localtime:ro \ | |
-e MARIADB_ROOT_PASSWORD=Fake_Password_Here \ | |
-e TZ=Europe/Berlin \ | |
-p 127.0.0.1:3307:3306/tcp \ | |
-p 127.0.0.2:3306:3306/tcp \ | |
--restart=unless-stopped \ | |
-d mariadb:10.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- create root password | |
-- | |
FLUSH PRIVILEGES; | |
CREATE USER 'root'@'%' IDENTIFIED BY 'Fake_Password_Here'; | |
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; | |
FLUSH PRIVILEGES; | |
-- | |
-- Check which root accounts exists | |
-- Check HOSTNAME | |
-- | |
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Fake_Password_Here'; | |
ALTER USER 'root'@'HOSTNAME' IDENTIFIED BY 'Fake_Password_Here'; | |
ALTER USER 'root'@'127.0.0.1' IDENTIFIED BY 'Fake_Password_Here'; | |
ALTER USER 'root'@'::1' IDENTIFIED BY 'Fake_Password_Here'; | |
ALTER USER 'root'@'%' IDENTIFIED BY 'Fake_Password_Here'; | |
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost'; | |
GRANT ALL PRIVILEGES ON *.* TO 'root'@'HOSTNAME'; | |
GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1'; | |
GRANT ALL PRIVILEGES ON *.* TO 'root'@'::1'; | |
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; | |
FLUSH PRIVILEGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment