zoukankan      html  css  js  c++  java
  • Error establishing a database connection解决

    我的这个问题。是数据库连接的问题,我没找到原因,后来用网易的镜像。可以了。

    后来mysql起不来,发现是宿主机的共享卷没有权限的问题,所以mysql的容器起不来,所以只要给共享卷授权就可以了

    ┌──[root@liruilongs.github.io]-[~/docker]
    └─$ docker ps | grep -v IMAGE | awk '{print $1}'| xargs docker rm -f
    1ce97e8dc071
    0d435b696a7e
    ┌──[root@liruilongs.github.io]-[~/docker]
    └─$ docker run -dit --name=db --restart=always -v $PWD/db:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=liruilong -e WORDPRESS_DATABASE=wordpress hub.c.163.com/library/mysql
    8605e77f8d50223f52619e6e349085566bc53a7e74470ac0a44340620f32abe8
    ┌──[root@liruilongs.github.io]-[~/docker]
    └─$ docker ps
    CONTAINER ID   IMAGE                         COMMAND                  CREATED         STATUS         PORTS      NAMES
    8605e77f8d50   hub.c.163.com/library/mysql   "docker-entrypoint.s…"   6 seconds ago   Up 4 seconds   3306/tcp   db
    ┌──[root@liruilongs.github.io]-[~/docker]
    └─$ docker run -itd --name=blog --restart=always -v $PWD/blog:/var/www/html -p 80 -e WORDPRESS_DB_HOST=172.17.0.2 -e WORDPRESS_DB_USER=root -e WORDPRESS_DB_PASSWORD=liruilong -e WORDPRESS_DB_NAME=wordpress hub.c.163.com/library/wordpr
    ess
    a90951cdac418db85e9dfd0e0890ec1590765c5770faf9893927a96ea93da9f5
    ┌──[root@liruilongs.github.io]-[~/docker]
    └─$ docker ps
    CONTAINER ID   IMAGE                             COMMAND                  CREATED         STATUS         PORTS                                     NAMES
    a90951cdac41   hub.c.163.com/library/wordpress   "docker-entrypoint.s…"   3 seconds ago   Up 2 seconds   0.0.0.0:49271->80/tcp, :::49271->80/tcp   blog
    8605e77f8d50   hub.c.163.com/library/mysql       "docker-entrypoint.s…"   2 minutes ago   Up 2 minutes   3306/tcp                                  db
    ┌──[root@liruilongs.github.io]-[~/docker]
    └─$

    加油,愿被这世界温柔以待 ^_^
  • 相关阅读:
    3月3日(6) Climbing Stairs
    testNG 预期异常、忽略测试、超时测试
    testNG 常用的注解
    testNG 下载安装
    selenium 执行js代码
    selenium 时间等待的方法
    selenium 文件上传
    selenium 键盘鼠标模拟
    selenium 窗口的切换
    selemiun 下拉菜单、复选框、弹框定位识别
  • 原文地址:https://www.cnblogs.com/liruilong/p/15368217.html
Copyright © 2011-2022 走看看