Skip to content

Add root user for localhost #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Add root user for localhost #32

wants to merge 1 commit into from

Conversation

wapolinar
Copy link

Grant all privileges to the root user for localhost.

This allows to execute mysql_secure_installation and remove remote
access from the root user while still being able to access the database
from localhost.

Grant all privileges to the root user for localhost.

This allows to execute mysql_secure_installation and remove remote
access from the root user while still being able to access the database
from localhost.
@tianon
Copy link
Contributor

tianon commented Dec 5, 2015

Why not instead do something like this as an initialization script? (something like /docker-entrypoint-initdb.d/localhost-root.sql)

UPDATE mysql.user SET host = 'localhost' WHERE user = 'root' AND host = '%' ;
FLUSH PRIVILEGES ;

@wapolinar
Copy link
Author

Yes, of course, but wouldn't this change the behaviour (i.e., not allowing the root user to connect from other servers than "localhost")? If you wish, I will modify this request to your suggestion.

@yosifkit
Copy link
Contributor

I think what @tianon is saying is that it is simple enough to add your own scripts to the initdb directory to accomplish the same thing for your own containers that it is not necessary to change the image.

@wapolinar
Copy link
Author

Yes, I figured that after writing my message...
I thought executing "mysql_secure_installation" is a suggested method before bringing the database into production and since executing bash is described on the mariadb docker docs, it is not clear that root access will be lost, if it is executed on the normal, official docker mariadb image.

Nevertheless, as an alternative, it could be added a section to the readme that describes the steps on how remote root access is disabled without removing root access completely, which could involve the execution of such an initialization script.

@tianon
Copy link
Contributor

tianon commented Dec 17, 2015 via email

@tianon
Copy link
Contributor

tianon commented Apr 5, 2017

Something similar to this was merged for https://github.com/docker-library/mysql in docker-library/mysql#249 -- looks like we need to do a "feature resync" again. 👍

@yosifkit yosifkit closed this in #102 Apr 5, 2017
@wapolinar wapolinar deleted the pull_request branch April 14, 2017 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants