Ubuntu 18.04 mysql安装

打算做个网站,学着安装mysql。网上查了一些教程,最后找到官网教程以及另一个教程,互为参照。我采用APT库安装方式,步骤如下:

  1. https://dev.mysql.com/downloads/repo/apt/下载.deb包并安装,出来图形界面直接默认选ok就行
$ sudo dpkg -i mysql-apt-config_0.8.10-1_all.deb
  1. 更新
$ sudo apt update

如果出现以下关于签名的问题

......                                 
Err:5 http://repo.mysql.com/apt/ubuntu bionic InRelease                                     
  The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <mysql-build@oss.oracle.com>
Get:8 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security InRelease [88.7 kB]                                                                                  
Hit:9 http://packages.microsoft.com/repos/vscode stable InRelease                                                                                                     
Reading package lists... Done                                                                                                                                         
W: GPG error: http://repo.mysql.com/apt/ubuntu bionic InRelease: The following signatures were invalid: EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering <mysql-build@oss.oracle.com>
E: The repository 'http://repo.mysql.com/apt/ubuntu bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

参考https://serverok.in/mysql-8-apt-error-the-following-signatures-were-invalid,注意要加sudo

$ sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 8C718D3B5072E1F5
  1. 安装mysql
$ sudo apt-get install mysql-server

要求设密码建议直接设成password谨防忘记
4. 查看状态,mysql会在安装后自动启动

$ sudo service mysql status

出现一下内容表示正常

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
   Active: active (running) since Mon 2019-09-09 19:34:14 CST; 16min ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 870 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=e
 Main PID: 937 (mysqld)
   Status: "Server is operational"
    Tasks: 38 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─937 /usr/sbin/mysqld

Sep 09 19:34:12 LoveBin systemd[1]: Starting MySQL Community Server...
Sep 09 19:34:14 LoveBin systemd[1]: Started MySQL Community Server.

关闭

$ sudo service mysql stop

重启

$ sudo service mysql start

到此差不多顺利安装完,后续的事后续再说

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值