zoukankan      html  css  js  c++  java
  • manjaro利用docker使用MySQL

    使用docker安装MySQL并使用

    • 安装docker:

      sudo yaourt -S docker
      
    • 使用docker安装mysql:

      systemctl start docker # 启动docker服务
      sudo docker pull mysql # 拉取mysql镜像
      
    • 将mysql镜像初始化成容器:

      sudo docker run --name demo -e MYSQL_ROOT_PASSWORD=123456 -d mysql 
      
    • 进入mysql容器的命令行:

      sudo docker exec -it demo bash
      
    • 使用命令登录上mysql服务器:

      mysql -u root -h 127.0.0.1 -p # 然后提示输入密码:输入123456,即可登录成功
      
      Welcome to the MySQL monitor.  Commands end with ; or g.
      Your MySQL connection id is 9
      Server version: 8.0.16 MySQL Community Server - GPL
      
      Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
      
      Oracle is a registered trademark of Oracle Corporation and/or its
      affiliates. Other names may be trademarks of their respective
      owners.
      
      Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
      
      mysql> 
      
    • 例子:创建数据库 demo ,数据库编码为 UTF-8

      create database `demo` character set utf8;
      
      Query OK, 1 row affected, 1 warning (0.02 sec)
      
  • 相关阅读:
    spring boot 与 spring cloud 版本映射
    Java锁
    并发编程(二)
    并发工具类和线程池
    并发编程
    Map双列集合(二)
    Map双列集合(一)
    单列集合List
    类加载
    JVM字节码与代码优化
  • 原文地址:https://www.cnblogs.com/yunche/p/11031823.html
Copyright © 2011-2022 走看看