远程操作mysql数据库
文章目录
【注意】最后更新于 May 24, 2017,文中内容可能已过时,请谨慎使用。
腾讯云服务器
申请账户,体验5天,搭建一个jira服务,还有微信小程序服务
需要在服务器上安装docker (腾讯服务器提供了一款支持docker的Ubuntu系统)
想使用daocloud加速器,就要更新docker版本 docker run –detach –publish 8080:8080 cptactionhank/atlassian-jira:latest http://[dockerhost]:8080 and finish the configuration
远程服务器的基本操作
- 登录:
ssh -l username 服务ip/域名
ssh ubuntu@123...6 5***RtH sudo docker pull cptactionhank/atlassian-jira - 服务器端拷贝文件目录 scp -i localDir serveruser@serverip:serverDir
docker下安装mysql数据库镜像
|
|
-name : 容器名 MYSQL_ROOT_PASSWORD : 数据库密码 -d : 镜像名:tag 版本
终端:单行登录mysql
|
|
进入mysql终端,访问数据库
|
|
用户权限控制
- 查看sql服务器的状态:
|
|
- 创建用户名
|
|
- 赋予权限
|
|
数据库操作
- 创建数据库
|
|
- 查看当前数据库名:
|
|
- 切换指定数据库
|
|
- 查看数据库表
|
|
创建表
jira和数据库关联结果
无法通过 docker 中mysql镜像的盒子来实现jira和数据库关联: 从另一个容器中的应用来访问jiradb容器中的mysql服务:没成功
|
|
最终采用在ubuntu系统中安装mysql:
|
|
##问题:Could not reach any registry endpoint 安装Linux加速器: curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://142900b5.m.daocloud.io 该脚本可以将 –registry-mirror 加入到你的 Docker 配置文件 /etc/default/docker 中。适用于 Ubuntu14.04、Debian、CentOS6 、CentOS7、Fedora、Arch Linux、openSUSE Leap 42.1,其他版本可能有细微不同。 ubuntu 系统安装daocloud检测工具: curl -sSL https://get.daocloud.io/daomonit/install.sh | sh -s d0312f829e9807ee0bf157cdc9c9cca42380395c
更新服务器上的docker
Update your apt sources
To set APT to use packages from the Docker repository:
- Log into your machine as a user with sudo or root privileges.
- Open a terminal window.
- Update package information, ensure that APT works with the https method, and that CA certificates are installed.
|
|
- Docker资源库
Ubuntu version Repository Precise 12.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-precise main Trusty 14.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-trusty main Wily 15.10 deb https://apt.dockerproject.org/repo ubuntu-wily main Xenial 16.04 (LTS) deb https://apt.dockerproject.org/repo ubuntu-xenial main
Note: Docker does not provide packages for all architectures. Binary artifacts are built nightly, and you can download them from https://master.dockerproject.org. To install docker on a multi-architecture system, add an [arch=…] clause to the entry. Refer to Debian Multiarch wiki for details.
- 导入库
= deb https://apt.dockerproject.org/repo ubuntu-precise main
|
|
` 6.Update the APT package index.
|
|
7.Verify that APT is pulling from the right repository. When you run the following command, an entry is returned for each version of Docker that is available for you to install. Each entry should have the URL https://apt.dockerproject.org/repo/. The version currently installed is marked with ***.The output below is truncated.
$ apt-cache policy docker-engine
docker-engine: Installed: 1.12.2-0~trusty Candidate: 1.12.2-0~trusty Version table: *** 1.12.2-0~trusty 0 500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages 100 /var/lib/dpkg/status 1.12.1-0~trusty 0 500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages 1.12.0-0~trusty 0 500 https://apt.dockerproject.org/repo/ ubuntu-trusty/main amd64 Packages
From now on when you run apt-get upgrade, APT pulls from the new repository.
To upgrade your kernel and install the additional packages, do the following:
Open a terminal on your Ubuntu host. Update your package manager. $ sudo apt-get update Install both the required and optional packages. $ sudo apt-get install linux-image-generic-lts-trusty Repeat this step for other packages you need to install. Reboot your host to use the updated kernel. $ sudo reboot After your system reboots, go ahead and install Docker.
Install the latest version Make sure you have satisfied all the prerequisites, then follow these steps.
Note: For production systems, it is recommended that you install a specific version so that you do not accidentally update Docker. You should plan upgrades for production systems carefully. Log into your Ubuntu installation as a user with sudo privileges. Update your APT package index. $ sudo apt-get update Install Docker. $ sudo apt-get install docker-engine Start the docker daemon. $ sudo service docker start Verify that docker is installed correctly by running the hello-world image. $ sudo docker run hello-world This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
文章作者 iTBoyer
上次更新 2017-05-24