一、简介
MySQL 是最流行的关系型数据库管理系统,在 WEB 应用方面 MySQL 是最好的 RDBMS(Relational Database Management System:关系数据库管理系统)应用软件之一。
二、下载
下载地址:https://www.mysql.com/
选MySQL Community downloads
选MySQL Community Server
选Ubuntu
选Ubuntu Linux 20.04 (x86, 64-bit), DEB Bundle
选 No thanks, just start my download.
下载后得到:mysql-server_8.0.21-1ubuntu20.04_amd64.deb-bundle.tar
将它放到soft/mysql-8.0.21共享目录下
三、安装
1.解压缩bundle.tar 文件
tar xvf mysql-server_8.0.21-1ubuntu20.04_amd64.deb-bundle.tar
得到如下文件
libmysqlclient21_8.0.21-1ubuntu20.04_amd64.deb
libmysqlclient-dev_8.0.21-1ubuntu20.04_amd64.deb
mysql-client_8.0.21-1ubuntu20.04_amd64.deb
mysql-common_8.0.21-1ubuntu20.04_amd64.deb
mysql-community-client_8.0.21-1ubuntu20.04_amd64.deb
mysql-community-client-core_8.0.21-1ubuntu20.04_amd64.deb
mysql-community-server_8.0.21-1ubuntu20.04_amd64.deb
mysql-community-server-core_8.0.21-1ubuntu20.04_amd64.deb
mysql-community-server-debug_8.0.21-1ubuntu20.04_amd64.deb
mysql-community-test_8.0.21-1ubuntu20.04_amd64.deb
mysql-community-test-debug_8.0.21-1ubuntu20.04_amd64.deb
mysql-server_8.0.21-1ubuntu20.04_amd64.deb
mysql-server_8.0.21-1ubuntu20.04_amd64.deb-bundle.tar
mysql-testsuite_8.0.21-1ubuntu20.04_amd64.deb
2.安装这些文件
tar xvf mysql-server_8.0.21-1ubuntu20.04_amd64.deb-bundle.tar
以下安装过程,要是出现依赖包未安装的错误提示,执行
sudo apt-get -f install
sudo dpkg -i mysql-common_8.0.21-1ubuntu20.04_amd64.deb
sudo dpkg -i libmysqlclient21_8.0.21-1ubuntu20.04_amd64.deb
sudo dpkg -i libmysqlclient-dev_8.0.21-1ubuntu20.04_amd64.deb
sudo dpkg -i mysql-community-client-core_8.0.21-1ubuntu20.04_amd64.deb
sudo dpkg -i mysql-community-client_8.0.21-1ubuntu20.04_amd64.deb
sudo dpkg -i mysql-client_8.0.21-1ubuntu20.04_amd64.deb
sudo dpkg -i mysql-community-server-debug_8.0.21-1ubuntu20.04_amd64.deb
sudo dpkg -i mysql-community-test-debug_8.0.21-1ubuntu20.04_amd64.deb
sudo dpkg -i mysql-community-server-core_8.0.21-1ubuntu20.04_amd64.deb
sudo dpkg -i mysql-community-server_8.0.21-1ubuntu20.04_amd64.deb
sudo dpkg -i mysql-server_8.0.21-1ubuntu20.04_amd64.deb
出现如下界面,输入root作为root密码
sudo dpkg -i mysql-community-test_8.0.21-1ubuntu20.04_amd64.deb
sudo apt-get -f install
sudo dpkg -i mysql-server_8.0.21-1ubuntu20.04_amd64.deb
sudo dpkg -i mysql-testsuite_8.0.21-1ubuntu20.04_amd64.deb
四、配置
基本不用配置
五、验证
mysql --version
mysql -u root -p
按提示输入root用户密码
show databases;
SELECT user, host FROM mysql.user;
更详细的验证和排错参考“好玩的大数据之05:MySQL安装方法二(利用apt-get安装)”