See this comment in the MySQL image's GitHub issue queue for more details.
I'm not 100% sure why a data volume works, while a shared volume doesn't, but the fix is to make sure you clear out the contents of the shared directory between rebuilds of the Docker environment. I switched from using a data volume ( db_data) to mounting a volume from my host ( mysqldata in the current directory), and after the next time I did a docker-compose down and docker-compose up, I started seeing the error about my host not being allowed to connect to the MySQL server. Using the official MySQL Docker image from Docker Hub, I recently ran into the error: Host 172.18.0.1 is not allowed to connect to this MySQL server The only change I had made to my docker-compose.yml file was: mysql: image: mysql:5.6 ports: - 3306 volumes: Use this option to persist the MySQL DBs in a shared volume. # Use this option to persist the MySQL DBs in a data volume. # Use this option to persist the MySQL DBs in a shared volume. The only change I had made to my docker-compose.yml file was: mysql: If you get the following error at this step, try again, but with a stronger password.Using the official MySQL Docker image from Docker Hub, I recently ran into the error: Host '172.18.0.1' is not allowed to connect to this MySQL server If you downloaded a different one, use that instead. microsoft/mssql-server-linux This tells Docker which image to use. This is the default TCP port that SQL Server uses to listen for connections. p 1433:1433 This maps the local port 1433 to port 1433 on the container. e 'SA_PASSWORD=myPassw0rd' Required parameter that sets the sa database password. You need to allow Docker to write to the /Documents/mysql directory. It raises a dialog box asking for permission to access the directory. You will use the 33060 port to connect to the Docker instance of MySQL.
This is required in order to install SQL Server. The docker run command maps the localhost’s 33060 port to the 3306 port on the Docker container. e 'ACCEPT_EULA=Y' The Y shows that you agree with the EULA (End User Licence Agreement). This can be handy when stopping and starting the container from the Terminal. name Homer This optional parameter provides a name for the container. You can omit this parameter to have the container run in its own Terminal window. This means that it runs in the background and doesn't need its own Terminal window open. if the container is already running, extract ip address/port from the output. if the container is stopped, re-start it with docker start.
Here's an explanation of the above parameters: -d This is an optional parameter that launches the Docker container in daemon mode. if the container is not running at all, start it with docker run. Also be sure to make a strong password, or you may get an error (see below).Īlso, if you downloaded a different container image, replace microsoft/mssql-server-linux with your container image.
Replace the container name and password with your own.
The Mac uses the Linux image (the SQL Server for Linux Docker image).ĭocker run -d -name Homer -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=myPassw0rd' -p 1433:1433 microsoft/mssql-server-linux Now that we've installed Docker and increased its memory allocation, we can go ahead and install SQL Server. OK, we're now ready to install SQL Server on your Mac. I've written a tutorial with screenshots: Install Docker on a Mac and Configure for SQL Server.
Therefore, there's no need to install a virtual machine with Windows (which was the only way to run SQL Server on a Mac prior to SQL Server 2017). Run the phpMyAdmin docker container Access MySQL via phpMyAdmin I tested this procedure on Windows and Mac using docker engine v19.03.13. This is made possible by running SQL Server from a Docker container. Microsoft has made SQL Server available for macOS and Linux systems.
Install SQL Server directly to your Mac - no virtual machine required!