Reputation: 680
I am creating a service in docker-compose. Look for the problem. In the net. most of them ask me to change mysql version. The code I have in my dockerfile is:
FROM mysql:8
COPY docker-initdb.sql /docker-entrypoint-initdb.d/initdb.sql
RUN ["mysqld", "--skip-mysqlx", "--default-authentication-plugin=mysql_native_password"]
I have this exception. when executing
Step 3/3 : RUN ["mysqld", "--skip-mysqlx", "--default-authentication-plugin=mysql_native_password"]
---> Running in 33916b9536b9
2019-08-22T17:35:34.255249Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2019-08-22T17:35:34.255316Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 1
2019-08-22T17:35:34.258135Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2019-08-22T17:35:34.258191Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-08-22T17:35:34.259440Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
Thank you.
Upvotes: 1
Views: 3372
Reputation: 4056
Docker Mysql v8 also gave me this error
2019-08-22T17:35:34.255249Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2019-08-22T17:35:34.255316Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.17) starting as process 1
2019-08-22T17:35:34.258135Z 0 [ERROR] [MY-010123] [Server] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2019-08-22T17:35:34.258191Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-08-22T17:35:34.259440Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.17) MySQL Community Server - GPL.
I think MySQL V8 needs some kind of extra config.
So I changed my Mysql image to 5.7.22 version and now it works. It's not the best solution but it's the fastest.
Upvotes: 0
Reputation: 10727
You should not use RUN but ENTRYPOINT to start the server. RUN is executing at build time. ENTRYPOINT is executed when the container starts.
FROM mysql:8
USER mysql
ENTRYPOINT mysqld --initialize --user=mysql && mysqld --skip-mysqlx --default-authentication-plugin=mysql_native_password
Also, you need to initialize the database and, as the error says, run the server as a different user than root.
Check the container logs for the root user password.
Upvotes: 2