目录
- 一、下载mysql安装包
- 二、下载依赖
- 三、安装mysql
- 四、导入sql
一、下载mysql安装包
下载地址:https://downloads.mysql.com/archives/community/
下载包 mysql-server_5.7.32-1ubuntu18.04_amd64.deb-bundle.tar
下载后解压,里面包含要安装的deb包
二、下载依赖
如果安装过程中报错没有安装依赖,下载对应的依赖,下面是几个常见的错误
(1)libtinfo5
下载地址
https://pkgs.org/download/libtinfo5
http://archive.ubuntu.com/ubuntu/pool/main/n/ncurses/libtinfo5_6.1-1ubuntu1_amd64.deb
(2)Libmecab2
下载地址
https://pkgs.org/download/libmecab2
http://archive.ubuntu.com/ubuntu/pool/universe/m/mecab/libmecab2_0.996-5_amd64.deb
(2)libaio1
下载地址
https://pkgs.org/download/libaio1
https://debian.pkgs.org/11/debian-main-arm64/libaio1_0.3.112-9_arm64.deb.html
三、安装mysql
#安装mysql
dpkg -i mysql-{common,community-client,client,community-server,server}_*.deb
dpkg -i libaio1_0.3.110-5_amd64.deb
dpkg -i mysql-common_5.7.32-1ubuntu18.04_amd64.deb
dpkg -i lib*.deb
dpkg -i libtinfo5_6.1-1ubuntu1_amd64.deb
dpkg -i dpkg -i mysql-community-client*.deb
dpkg -i mysql-community-client*.deb
dpkg -i mysql-community-source_5.7.32-1ubuntu18.04_amd64.deb
dpkg -i mysql-client_5.7.32-1ubuntu18.04_amd64.deb
dpkg -i libmecab2_0.996-5_amd64.deb
dpkg -i mysql-community-server_5.7.32-1ubuntu18.04_amd64.deb
dpkg -i mysql-server_5.7.32-1ubuntu18.04_amd64.deb
如果有版本冲突的报错,则可以执行:
sudo dpkg -i --force-overwrite xxx.deb
四、导入sql
#登录导入数据库
将root用户密码设置为root
mysql -u root -p
alter user user() identified by "root";
GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY 'root' WITH GRANT OPTION;
flush privileges;
create database dmo;
use dmo;
source /tmp/dmo.sql