Ubuntu24.04.2安装MySQL8.0.43

155 阅读1分钟

基本信息

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

基本信息.png

参考资料

官方文档:
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. 进入安装流程

安装.png

3. 下载repository

image.png

4. 下载repo

repo.png

5. 不登录,直接下载

直接下载.png

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 下载repo.png

7. 下载发行包

  • c. Install the downloaded release package with the following command
  • sudo dpkg -i mysql-apt-config_0.8.34-1_all.deb 下载发行包.png

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

选择版本1.png

2. 选择8.0

选择版本2.png

3. 选择ok

选择版本3.png

9. 更新仓库

  • e. Update package information from the MySQL APT repository with the following command
  • sudo apt-get update 更新仓库.png

10. 安装mysql

  • Installing MySQL with APT

  • sudo apt-get install mysql-server 安装mysql.png

    1. 输入root用户的登录密码,然后点击ok root密码.png
    1. 重新输入密码,然后点击ok 重新输入密码.png
    1. 选择密码加密规则,选用caching_sha2_password模式 caching_sha2_password.png
    1. 查看mysql是否启动
    1. 登录mysql
systemctl status mysql
mysql -uroot -p

image.png

    1. 修改密码
  • sudo mysql_secure_installation

image.png

image.png

image.png

image.png

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