手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

如何在Debian 10(Buster)Linux上安装MySQL

[日期:2019-07-26] 来源:Linux公社  作者:醉落红尘 [字体: ]

如何在Debian 10(Buster)Linux上安装MySQL

到今天为止,Debian Buster是Debian操作系统的最新版本。也称为Debian 10。较新的Debian版本在其存储库中默认使用了MariaDB。现在,本教程将帮助您在Debian 10 (Buster) Linux系统上安装MySQL 8或MySQL 5.7。

第1步 - 必要条件

使用shell访问权限登录Debian 10系统。 对于远程系统,使用SSH连接。 Windows用户可以使用Putty或其他替代应用程序进行SSH连接。

ssh root@debian10

运行以下命令将当前包升级到最新版本。

sudo apt update 
sudo apt upgrade

第2步 - 配置MySQL PPA

MySQL团队为Debian Linux提供官方MySQL PPA。 您可以在Debian系统上下载并安装该软件包,这会将PPA文件添加到您的系统中。 运行以下命令以启用PPA。

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

在安装MySQL apt config包期间,它会提示选择MySQL版本进行安装。 选择要在系统上安装的MySQL 8.0或5.7选项。

在本教程中,我们已选择MySQL 5.7在我的Debian系统上安装。 选择特定版本并需要更改配置后,请使用以下命令。

sudo dpkg-reconfigure mysql-apt-config

选择您选择的版本并保存。

第3步 - 在Debian 10上安装MySQL

您的系统已准备好安装MySQL。 运行以下命令在Debian计算机上安装MySQL。

sudo apt update 
sudo apt install mysql-server

安装过程将提示root密码设置为默认值。 输入安全密码,确认密码窗口。 这将是登录MySQL服务器所需的MySQL root用户密码。

如何在Debian 10(Buster)Linux上安装MySQL

下一个窗口将要求重新输入相同的密码。

MySQL 8提供了扩展的密码安全选项。 这是可选的,但我们建议使用此选项。

Debian install MySQL

让安装完成。

第4步 - 安全MySQL安装

在系统上执行以下命令以对数据库服务器进行安全性更改。 这会提示一些问题。 高安全性提供所有答案是肯定的。

如果没有启动,首先启动MysQL服务:

sudo systemctl restart mysql.service

然后运行以下命令:

sudo mysql_secure_installation

按照屏幕上的指示进行操作

Securing the MySQL server deployment.

Enter password for user root:

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: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2

[...]

选择MEDIUM或STRONG的密码验证策略。 之后,该过程将要求更改密码。 您可以选择更复杂的密码。 按照其他选项完成向导。

第5步 - 连接MySQL

MySQL服务器已安装在您的系统上。 现在使用命令行连接到MySQL数据库。

mysql -u root -p

Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.17 MySQL Community Server - GPL

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

Linux公社的RSS地址https://www.linuxidc.com/rssFeed.aspx

本文永久更新链接地址https://www.linuxidc.com/Linux/2019-07/159582.htm

linux
相关资讯       Linux安装MySQL  Debian 10安装MySQL 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款