如何在Debian 10 Linux上安装MySQL
admin
2023-08-03 05:55:09
0

默认的Debian存储库中没有提供MySQL,这是世界上最流行的开源关系数据库管理系统。MariaDB是Debian 10中的默认数据库系统。

本教程说明了如何从MySQL Apt Repository在Debian 10上安装和保护MySQL 。

配置MySQL存储库

要将MySQL APT存储库添加到您的系统,请转到存储库下载页面,并使用以下wget命令下载最新的发行包:

wget http://repo.mysql.com/mysql-apt-config_0.8.13-1_all.deb

下载完成后,以具有sudo特权的用户身份安装发行包:

sudo apt install ./mysql-apt-config_0.8.13-1_all.deb

系统将显示配置菜单,从中可以选择要安装的MySQL版本。

get-57get-57

预先选择了MySQL 8.0,如果要安装MySQL 5.7,请选择MySQL Server & Cluster (Currently selected: mysql-8.0)并选择您喜欢的MySQL版本

我们将安装MySQL 8.0版。OK通过按下Tab并点击进行选择Enter(如上图所示)。

如果不确定要选择哪个版本,请查阅要在服务器上部署的应用程序的文档。

安装MySQL

使用以下命令更新软件包列表并安装MySQL服务器软件包:

sudo apt update
sudo apt install mysql-server

安装程序将要求您设置MySQL根密码。现在不要设置密码(将其保留为空白),我们将在下一部分中进行设置。

接下来,将向您显示一条消息,通知您有关新的MySQL 8身份验证的信息。在选择默认的MySQL 8身份验证插件之前,请确保您的应用程序支持它。

get-58get-58

安装完成后,MySQL服务将自动启动,您可以通过键入以下内容进行验证:

sudo systemctl status mysql
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
   Active: active (running) since Fri 2019-07-26 13:23:25 PDT; 37s ago
   ...

保护MySQL

运行mysql_secure_installation命令以设置root密码并提高MySQL安装的安全性:

sudo mysql_secure_installation
Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No:

系统将要求您配置VALIDATE PASSWORD PLUGIN用来测试MySQL用户密码强度的密码。密码验证策略分为三个级别:低,中和强。出版社ENTER如果你不想来设置验证密码插件。

Please set the password for root here.

New password:

Re-enter new password:

在下一个提示符下,将要求您设置MySQL root用户的密码。

By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
\'localhost\'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named \'test\' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

一旦设置了root密码,脚本还将要求您删除匿名用户,限制root用户对本地计算机的访问并删除测试数据库。您应该对所有问题回答“是”(是)。

 

相关内容

热门资讯

Windows 11 和 10... Windows 11/10 文件夹属性中缺少共享选项卡 – 已修复 1.检查共享选项卡是否可用 右键...
Radmin VPN Wind... Radmin VPN 是一款免费且用户友好的软件,旨在牢固地连接计算机以创建一个有凝聚力的虚拟专用网...
如何修复 Steam 内容文件... Steam 内容文件锁定是当您的 Steam 文件无法自行更新时出现的错误。解决此问题的最有效方法之...
在 Windows 11 中打... 什么是链路状态电源管理? 您可以在系统控制面板的电源选项中看到链接状态电源管理。它是 PCI Exp...
iPhone 屏幕上有亮绿色斑... iPhone 是市场上最稳定的智能手机之一,这主要归功于专为它们设计的 iOS 操作系统。然而,他们...
事件 ID 7034:如何通过... 点击进入:ChatGPT工具插件导航大全 服务控制管理器 (SCM) 负责管理系统上运行的服务的活动...
QQ浏览器怎么制作简历 QQ浏览器是腾讯公司开发的一款极速浏览器,支持电脑,安卓,苹果等多种终端;更快的浏览体验,更安全的浏...
Hive OS LOLMine... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
Apple Watch Ult... 所有运行 watchOS 7 或更高版本的 Apple Watch 型号都包含一项名为“优化电池充电...
统信UOS每次开机后不直接进入... 统信UOS每次开机后不直接进入系统而是进入到recovery模式 按方向上键选择UOS 20 SP1...