Introduction: Docker is a qualified Java development engineer must master the knowledge, fox will write down their own understanding, this article only represents my summary and understanding, if there are mistakes, welcome to correct…
www.cnblogs.com/baizhanshi/…
1, mysql image download.
Docker pull mysql: 8.0.18
2. Ignore case when creating the container.
docker run –name mysql -p 8089:3306 -e MYSQL_ROOT_PASSWORD=zshine08 -d mysql –lower_case_table_names=1
The mysql 8 configuration file is in: /etc/mysql.my.cnf
docker run -p 3306:3306 –name mysql -v /opt/docker_v/mysql/conf:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=123456 -d imageID
The above file mount is useless. So you can modify the my.cnf file directly in the container by adding: bind-address = 0.0.0.0 to allow external connections
3. Copy the file to the container
docker cp mysql:/etc/mysql/my.cnf /home/docker_data/mysql/ docker cp /home/docker_data/mysql/conf/my.cnf mysql:/etc/mysql/my.cnf
4. Enter mysql container
docker exec -it mysql sh
5. Access the mysql database
Mysql -u root -p Enter the password to access the database
6. Add navICat connection permission
ALTER user ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘123456’; ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘Lzslov123! ‘;
7. Enable the configuration to take effect
FLUSH PRIVILEGES;
Finally, navICat is available
Conclusion: Ever is to learn to read people’s blog technology, some of them have essence blog also have to play around the CV of solution, so the decided to study the knowledge sharing for everyone, mainly want to go to the sea after less detours, more positive energy blog, if there are any errors, welcome to point out mistakes, only hope that we can learn knowledge in my blog, Solve the problem, then it is enough. Thank you! (Please note the original source for reprint)