sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak cd /etc/apt vim sources.list
把源替换成阿里源、清华源或中科大源。这里我选择了阿里源
1 2 3 4 5 6 7 8 9 10 11
# 阿里源 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
安装mysql-server
1
sudo apt install mysql-server
启动mysql
1 2
sudo /etc/init.d/mysql start [ ok ] Starting mysql (via systemctl): mysql.service.
查看mysql版本验证是否安装成功
1 2
mysql --version mysql Ver 14.14 Distrib 5.7.42, for Linux (x86_64) using EditLine wrapper
进入mysql
1
sudo mysql
创建一个新的用户并配置密码
1
CREATE USER 'tony'@'%' IDENTIFIED BY 'yourpasswd';