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)
      
  • 相关阅读:
    delete误删除恢复
    oracle自增字段
    oracle唯一约束
    linux得到系统当前日期
    to_char+fm
    oracle范围分区
    oracle之use_hash用法
    oracle11g的regexp函数
    第一个脚本输入参数
    使用ctl将txt或csv文件导入表数据
  • 原文地址:https://www.cnblogs.com/yunche/p/11031823.html
Copyright © 2011-2022 走看看