![]() ![]() TX packets:10280 errors:0 dropped:0 overruns:0 carrier:0 RX packets:18827 errors:0 dropped:0 overruns:0 frame:0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 For example: $ docker-machine ssh default If you are using Mac (or Windows) with docker-machine you want to connect to the IP address of your docker-machine VM. Not sure why you are trying to run another container to connect (perhaps you meant linking two containers) Then you can access from your host using the mysql command line: mysql -h127.0.0.1 -ppassword -uroot So you basically you need to expose the mysql port to your host: docker run -name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql/mysql-server:latest All topics are about connecting to official Image of MS SQL-Serverwhich I dont need. Problem is I didt find any releated topics about how to connect to external already existing MS SQL server not in docker image database from container. I am trying to get my php script to query my sql database. port is 3306, user is root, password is password, database is MyDB. Im new in Docker and we are migrating our working ASP.NET CORE app to Docker in company. I have two containers, a apache-php container, and a mysql db container. GRANT ALL PRIVILEGES ON *.* TO WITH GRANT OPTION docker run -name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql/mysql-server:latest Finally the steps which worked for me are 1. You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORDīut you see that I have provided the password and initialized my database.Īll I want is that from my host machine, I can connect to the mysql database running inside docker.ĮDIT:: - solution which worked. ![]() Now I get the error MacBook-Pro:~$ docker run -it -v /Users/abhi/host:/shared mysql/mysql-serverĮrror: database is uninitialized and password option is not specified docker run -it -v /host:/shared mysql/mysql-server:latest GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY 'password' ĩ. docker run -name mysql -e MYSQL_ROOT_PASSWORD=password -d mysql/mysql-server:latestĦ. towards this I have done the following steps 1. But I am facing a problem.īasically, I want to create a docker image for mysql and then connect to it from my host machine (Mac OS X).īased on this post, I have to share the mysql unix socket with the host. ![]() Based on these threads I have followed the following steps. I have already googled on this subject and found few threads. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |