一、下载安装包
https://downloads.mysql.com/archives/community/
使用wget命令下载tar包
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-server_5.7.42-1ubuntu18.04_amd64.deb-bundle.tar
sudo tar -xvf mysql-server_5.7.42-1ubuntu18.04_amd64.deb-bundle.tar
二、安装MySQL
#更新依赖源数据
sudo apt-get update
#安装依赖lib包
sudo apt-get install ./libmysql*
sudo apt-get install libtinfo5
#安装客户端和服务端,按提示可能要先安装community版本
sudo apt-get 安装客户端和服务端,按提示可能要先安装community版本install ./mysql-community-client_5.7.42-1ubuntu18.04_amd64.deb
sudo apt-get install ./mysql-client_5.7.42-1ubuntu18.04_amd64.deb
sudo apt-get install ./mysql-community-server_5.7.42-1ubuntu18.04_amd64.deb
sudo apt-get install ./mysql-server_5.7.42-1ubuntu18.04_amd64.deb
第三行命令执行时会提示设置MySQL的密码,用户名默认root
三、启动MySQL
systemctl start mysql
配置mysql
vim /etc/mysql/mysql.conf.d/mysqld.cnf
[mysqld]
log_bin = /var/log/mysql/mysql-bin.log
server_id = 3
expire_logs_days = 10
max_binlog_size = 100M
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
重启mysql
标签:amd64,get,mysql,sudo,apt,ubuntu,安装,1ubuntu18.04 From: https://www.cnblogs.com/chuanghongmeng/p/18325005