基本信息
vbox 版本 7.1.10 r169112 (Qt6.5.3)
ubuntu 24.04.2
MySQL 8.0.42
hostname mysql50
网卡 10.0.2.50/24、192.168.56.50/24
参考资料
官方文档:
1. [MySQL :: MySQL 8.0 Reference Manual :: 2.5.2 Installing MySQL on Linux Using the MySQL APT Repository](https://dev.mysql.com/doc/refman/8.0/en/linux-installation-apt-repo.html)
2. [MySQL :: A Quick Guide to Using the MySQL APT Repository](https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/#apt-repo-fresh-install)
参考资料
1. [Ubuntu 安装MySQL 8.0.23及以上版本 - Magiclala - 博客园](https://www.cnblogs.com/Magiclala/p/16638781.html)
安装流程
1. 访问官方地址,按照下图流程,进入下载、安装指引
2. 进入安装流程
3. 下载repository
4. 下载repo
5. 不登录,直接下载
6. 下载repo
- a. Go to the download page for the MySQL APT repository
- b. Select and download the release package for your Linux distribution.
wget https://dev.mysql.com/get/mysql-apt-config_0.8.34-1_all.deb
7. 下载发行包
- c. Install the downloaded release package with the following command
sudo dpkg -i mysql-apt-config_0.8.34-1_all.deb
8. 选择版本:mysql8.0
- d. During the installation of the package, you will be asked to choose the versions of the MySQL server and other components that you want to install
1. 选择mysql server
2. 选择8.0
3. 选择ok
9. 更新仓库
- e. Update package information from the MySQL APT repository with the following command
sudo apt-get update
10. 安装mysql
-
Installing MySQL with APT
-
sudo apt-get install mysql-server -
- 输入root用户的登录密码,然后点击ok
- 输入root用户的登录密码,然后点击ok
-
- 重新输入密码,然后点击ok
- 重新输入密码,然后点击ok
-
- 选择密码加密规则,选用
caching_sha2_password模式
- 选择密码加密规则,选用
-
- 查看mysql是否启动
-
- 登录mysql
systemctl status mysql
mysql -uroot -p
-
- 修改密码
sudo mysql_secure_installation
11. 登录数据库,创建远程访问账号
mysql -uroot -p
use mysql;
CREATE USER 'hhw'@'%' IDENTIFIED BY '1qaz!QAZ';
GRANT ALL PRIVILEGES ON *.* TO 'hhw'@'%';
FLUSH PRIVILEGES;
select user, host, plugin, authentication_string from user;
12. 登录数据库客户端,验证登录
- 使用DBeaver
服务器地址 192.168.56.50
用户名 hhw
密码 1qaz!QAZ
驱动数据设置
allowPublicKeyRetrieval true
useSSL false