Ubuntu18.04 安装mysql5.7

离线安装

1. 系统环境

系统:ubuntu-18.04.6-live-server-amd64

数据库:mysql-server_5.7.42

2. 下载依赖

  • libmecab2_0.996-5_amd64.deb
  • libaio1_0.3.110-5_amd64.deb
  • libc6_2.27-3ubuntu1_amd64.deb

3. 下载数据库安装包

  • mysql-server_5.7.42-1ubuntu18.04_amd64.deb-bundle.tar

4. 安装依赖

sudo dpkg -i libmecab2_0.996-5_amd64.deb
sudo dpkg -i libaio1_0.3.110-5_amd64.deb
sudo dpkg -i libc6_2.27-3ubuntu1_amd64.deb

5. 解压mysql数据库安装包

#解压mysql安装包
sudo tar -xvf mysql-server_5.7.42-1ubuntu18.04_amd64.deb-bundle.tar
# 查询解压后数据
ll
# 结果
libmysqlclient20_5.7.42-lubuntu13.04_amd64.deb
libmysqlclient-dev_5.7.42-1ubuntul3.04_amd64.deb
libmysqld-dev_5.7.42-1ubuntul8.04_amd64.deb
mysql-client_5.7.42-lubuntu18.04_amd64.deb
mysql-common_5.7.42-1ubuntu18.04_amd64.deb
mysql-community-client_5.7.42-lubuntul3.04_amd64.deb
mysql-community-server_5.7.42-1ubuntu18.04_amd64.deb
mysql-community-source_5.7.42-lubuntu18.04_amd64.deb
mysql-community-test_5.7.42-lubuntu18.04_amd64.deb
mysql-server_5.7.42-1ubuntu18.04_amd64.deb
mysql-testsuite_5.7.42-1ubuntu18.04_amd64.deb

6. 安装mysql

按照顺序安装MySQL文件

sudo dpkg -i mysql-common_5.7.42-1ubuntu18.04_amd64.deb
# 此步需要输入数据库的root账号的密码
sudo dpkg-preconfigure mysql-community-server_5.7.42-1ubuntu18.04_amd64.deb
sudo dpkg -i libmysqlclient20_5.7.42-lubuntu13.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_5.7.42-1ubuntul3.04_amd64.deb
sudo dpkg -i libmysqld-dev_5.7.42-1ubuntul8.04_amd64.deb
sudo dpkg -i mysql-community-client_5.7.42-lubuntul3.04_amd64.deb
sudo dpkg -i mysql-client_5.7.42-lubuntu18.04_amd64.deb
sudo dpkg -i mysql-common_5.7.42-1ubuntu18.04_amd64.deb
sudo dpkg -i mysql-community-source_5.7.42-lubuntu18.04_amd64.deb
sudo dpkg -i mysql-server_5.7.42-1ubuntu18.04_amd64.deb

7. 检查mysql安装是否成功

mysql -u root -p

8. 修改MySQL 配置


修改mysql配置文件:mysqld.cnf   
修改 bind-address = 0.0.0.0
service mysql restart

9. 修改数据库root配置

#链接数据库,输入密码
mysql -u root -p  
# 使用数据库,访问mysql库
use mysql         
# 修改用户表配置      
update user set host = '%' where user = 'root';
# 刷新执行结果
flush privileges;

10. 离线安装完成

你可能感兴趣的:(MySql,数据库)