mysql - 无法在 cent 0s 6.10 上启动 Mysql 5.7

标签 mysql security centos root

我正在尝试在 CentOS 6.10 上设置 MySql 5.7。我已经安装了 MySQL,但是当我尝试运行 sudo service mysqld start 时,它没有启动。错误是

2018-11-05T17:14:57.569757Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-11-05T17:14:57.573328Z 0 [Note] mysqld (mysqld 5.7.24) starting as process 10355 ...
2018-11-05T17:14:57.575610Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2018-11-05T17:14:57.575652Z 0 [ERROR] Aborting

2018-11-05T17:14:57.575671Z 0 [Note] Binlog end
2018-11-05T17:14:57.575741Z 0 [Note] mysqld: Shutdown complete

我想这与将用户类型选择为 root 有关,但我不知道该怎么做。有人可以帮忙吗?提前致谢

最佳答案

看起来 mysqld 现在配置为以 root 用户身份运行,这不是推荐的运行方式——因此会出现硬警告,迫使您更改配置。您应该改为以安装软件包时为您创建的 mysql 用户身份运行。

通过查看 my.cnf 的 [mysqld] 部分,您可以看到用户 mysqld 设置为在其下运行。很可能您有 user=root,或者正在应用 --user=root 的命令行标志。

最佳做法是将其配置为使用非特权 mysql 用户。


相关文档:

How to Run MySQL as a Normal User文档页面表明:

the MySQL server mysqld should be started by the local mysql operating system user. Starting by another operating system user is not supported by the init scripts that are included as part of the installation.

MariaDB(MySQL 的一个分支)提供了一个名为 Running mysqld as root 的文档页面这表明:

MariaDB should never normally be run as the system's root user (this is unrelated to the MariaDB root user). If it is, any user with the FILE privilege can create or modify any files on the server as root.

MariaDB will normally return the error Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root! if you attempt to run mysqld as root. If you need to override this restriction for some reason, start mysqld with the user=root option.

Better practice, and the default in most situations, is to use a separate user, exclusively used for MariaDB. In most distributions, this user is called mysql.

关于mysql - 无法在 cent 0s 6.10 上启动 Mysql 5.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53159126/

相关文章:

php - 无法在 CentOS 上安装 php 5.x, `remi-php56.repo` 中的错误

linux - 如何在 Perl 中检查已安装的 Apache 模块?

mysql 查询问题 - 生成再订购报告

php - 已经存在的数据查询和绕过php mysql中的新条目

MySQL 从 2 列更新两行

php - 如何在php中插入mysql的自增字段id并将一张表的id更新为另一张表?

java - 配置ESAPI安全编码库,防止XSS跨站脚本问题

asp.net - 构建输入文本区域以允许 HTML 但防止安全/脚本攻击

linux - 如何在 Linux 服务器上加密我的 Web 应用程序

linux - Apache/PHP 内存使用