debain下mysql5.7安装

本文详细介绍了在Ubuntu系统中安装和配置MySQL5.7的步骤,包括检查和卸载旧版本、下载并安装最新版本、解决依赖问题、配置服务器启动及远程访问权限等关键环节。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 首先输入mysql --version看有没有安装过其他版本的mysql,有的话卸载掉

apt-get remove mysql-common
apt-get remove mysql*

2. 下载包并解压升级

下载地址:https://repo.mysql.com//mysql-apt-config_0.8.10-1_all.deb

sudo dpkg -i mysql-apt-config_0.8.9-1_all.deb 
sudo apt-get update

若更新过程中出现错误:EXPKEYSIG 8C718D3B5072E1F5 MySQL Release Engineering

执行以下操作再次更新就OK

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8C718D3B5072E1F5
sudo apt-get update

3. 安装mysql

sudo apt-get install mysql-server mysql-common

若是报如下错:

换成下面源(vi /etc/apt/sources.list),然后再apt-get update

deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib

再次执行安装 sudo apt-get install mysql-server mysql-common

4. 启动mysql5.7

service mysql start

5. 添加访问权限

vi /etc/mysql/mysql.conf.d/mysqld.cnf

bind-address = 0.0.0.0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值