Sign inSign up

cael/mariadb

By cael

•Updated almost 11 years ago

Mariadb on Centos 7

Image
0

10K+

cael/mariadb repository overview

Nothing special just a simple Mariadb on Centos 7 with password in the Dockerfile.

⁠Dockerfile:

# Default stuffs
FROM centos
MAINTAINER [email protected]

# Install mariadb-server and set up the database directory.    
RUN yum install mariadb-server -y && mysql_install_db --user=mysql --ldata=/var/lib/mysql/

# Drop the anonymous users and disable root remote access. Drop the test database and create the root user that can only connect from the docker host.
RUN mysqld_safe --nowatch && sleep 2 && mysql -e "drop user ''@localhost;drop user ''@$(echo $HOSTNAME);drop user 'root'@$(echo $HOSTNAME);drop database test;GRANT ALL PRIVILEGES ON *.* TO root IDENTIFIED BY 'root' WITH GRANT OPTION;select user,host,password from mysql.user;" && mysqladmin shutdown

# Expose the magic port.
EXPOSE 3306

# Start the database process.
CMD mysqld_safe

⁠Start with:

docker run -d --restart="always" -p 127.0.0.1:3306:3306 --name mariadb cael/mariadb

⁠Connect to the database with:

mysql -h 127.0.0.1 -u root --password=root

Tag summary

Content type

Image

Digest

sha256:eba741123…

Size

139.2 MB

Last updated

almost 11 years ago

docker pull cael/mariadb