Ubuntu下MySQL5.7安装步骤
1**、更新软件包列表**apt-get update2**、查看系统默认安装的数据库版本**apt-cache policy mysql-server3**、需要安装mysql5.7的版本就需要换源**养成习惯先备份文件cp /etc/apt/sources.list /etc/apt/sources.list.back然后更换apt源修改sources.list文件vim /etc/apt/sources.list# 阿里源deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiversedeb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse更新 镜像源gpg --keyserver keyserver.ubuntu.com --recv 3B4FE6ACC0B21F32gpg --export --armor 3B4FE6ACC0B21F32 | apt-key add -apt-get update查看默认安装的mysql数据库版本,可以看到默认的已经变成了mysql5.7的版本了4**、安装MySQL并查看是否安装完成**安装过程中需要确认的直接默认点ok进入下一步即可apt-get -y install mysql-server-5.7## 查看mysql是否安装成功dpkg -l | grep mysqlmysql -Vsystemctl status mysql设置开机自启systemctl enable mysql5**、修改服务为全网启动**6**、换回apt源**cd /etc/aptmv sources.list sources.list.oldmv sources.list.back sources.listapt-get update7**、设置允许远程访问**usemysql;updateusersethost%whereuserrootandhostlocalhost;-- 修改root密码为root并授权grantallprivilegeson*.*toroot%identifiedbyrootwithgrantoption;flushprivileges;转至https://blog.csdn.net/trisyp/article/details/141860593