Ubuntu 19.04 安装 MySQL 5.7.27 Community(社区版)Server

  1. 下载需要的包:
    下载顺序就是安装顺序。
    wget http://repo.mysql.com/apt/ubuntu/pool/mysql-5.7/m/mysql-community/mysql-community-client_5.7.27-1ubuntu19.04_amd64.deb
    
    wget http://repo.mysql.com/apt/ubuntu/pool/mysql-5.7/m/mysql-community/mysql-client_5.7.27-1ubuntu19.04_amd64.deb
    
    wget http://repo.mysql.com/apt/ubuntu/pool/mysql-5.7/m/mysql-community/mysql-community-server_5.7.27-1ubuntu19.04_amd64.deb
  2. 安装 MySQL 依赖:
    sudo apt-get install libaio1 libmecab2
  3. 安装 MySQL 并设置 root 密码:
    sudo dpkg -i mysql-community-client_5.7.27-1ubuntu19.04_amd64.deb
    
    sudo dpkg -i mysql-client_5.7.27-1ubuntu19.04_amd64.deb
    
    sudo dpkg -i mysql-community-server_5.7.27-1ubuntu19.04_amd64.deb
    安装最后一个包时,会弹窗,让你设置 root 密码:

     
  4. 安装完成自动启动,包括设置开机自启。
     
  5. 登录:
    Server version: 5.7.27 MySQL Community Server (GPL)
    xuxiaowei@virtual-machine:~$ mysql -u root -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 2
    Server version: 5.7.27 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> 
    
  6. 安装完成自动启动,包括设置开机自启。
    1. 查看状态:
      systemctl status mysql.service
    2. 关闭:
      systemctl stop mysql.service
    3. 开启:
      systemctl start mysql.service
    4. 查看开机启动:
      systemctl list-unit-files |grep mysql
      
    5. 关闭开机启动:
      需要使用 root 进行操作。
      systemctl disable mysql.service
    6. 打开开机启动:
      需要使用 root 用户进行操作。
      systemctl enable mysql.service
  • 5
    点赞
  • 3
    评论
  • 6
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值