guest@ro0t: ~ — bash theme: [green] [amber]

guest@ro0t:~$ echo $MOTD

notes, code and logs from the superuser

guest@ro0t:~/blog$ cat test.md

# test

by darthoreo · · in blog/

#home

To create the ro0t user inside your MariaDB container, run the SQL commands via docker exec using '%' as the host instead of 'localhost'.

1. Run the SQL Commands

Because Docker containers treat incoming traffic from your host machine or other containers as remote connections, 'localhost' will block external logins. Use '%' to allow connections from any host:
bash
'docker exec -i mariadb-server mariadb -u root -pYourStrongPassword << 'EOF'
CREATE USER 'ro0t'@'%' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON your_database_name.* TO 'ro0t'@'%';
FLUSH PRIVILEGES;
EOF'
Use code with caution.
(Replace YourStrongPassword with your container's root password, strong_password with the new password for ro0t, and your_database_name with your database name—or use *.* if you want ro0t to have access to all databases.)

2. Optional: Allow Local Socket Logins Too

If you also plan to log in as ro0t directly from inside the container shell, create a matching 'localhost' entry:
bash
docker exec -i mariadb-server mariadb -u root -pYourStrongPassword << 'EOF'
CREATE USER 'ro0t'@'localhost' IDENTIFIED BY 'strong_password';
GRANT ALL PRIVILEGES ON your_database_name.* TO 'ro0t'@'localhost';
FLUSH PRIVILEGES;
EOF
Use code with caution.

3. Verify the New User

Test logging in with the newly created ro0t account:
bash
docker exec -it mariadb-server mariadb -u ro0t -p
Use code with caution.

-- EOF --

[ cd .. ]