mysql提示Please read “Security“ section of the manual to find out how to run mysqld as root!

mysql提示Please read “Security“ section of the manual to find out how to run mysqld as root!

码农世界 2024-05-28 后端 66 次浏览 0个评论

一、mysql提示Please read “Security“ section of the manual to find out how to run mysqld as root!

      使用/usr/local/mysql/bin/mysqld start启动mysql 时,mysql提示 mysql提示Please read “Security“ section of the manual to find out how to run mysqld as root!

Please read "Security" section of the manual to find out how to run mysqld as root!

    这是让我们查看mysql的安全部分,去查找如何使用root来启动mysql,下面是Security Section的内容:

*Never run the MySQL server as the Unix `root' user. This is

  extremely dangerous, because any user with the `FILE' privilege is

  able to cause the server to create files as `root' (for example,

  `~root/.bashrc'). To prevent this, *Note `mysqld': mysqld. refuses

  to run as `root' unless that is specified explicitly using the

  `--user=root' option.

    翻译后的内容:永远不要使用root帐号启动MySQL Server。这样做很危险,因为拥有FILE'权限的用户会使得MySQL Server使用root帐户创建文件(比如,~root/.bashrc),为了防止类似的事情发生,mysqld默认拒绝用户使用root帐户启动,但root用户可以通过在命令后面加上"--user=root"选项来强行启动mysqld。

  *Note `mysqld': mysqld. can (and should) be run as an ordinary,unprivileged user instead. You can create a separate Unix account named `mysql' to make everything even more secure. Use this account only for administering MySQL. To start *Note `mysqld': mysqld. as a different Unix user, add a `user' option that specifies the user name in the `[mysqld]' group of the `my.cnf' option file where you specify server options. For example:

          [mysqld]

          user=mysql

   翻译后的内容:与使用root用户启动mysqld相比,更好的方法是使用一个普通的、没有高级权限的用户帐户允许mysqld,例如创建一个名为mysql的用户帐户来专门管理MySQL。使用其帐启动MySQL的方法是在mysqld命令后面加上一个用户选项,这个用户属于mysqld用户组并且位 my.cnf配置文件中。例如在创建mysql帐户后,可以将下面的内容添加到my.cnf文件中:

[mysqld]

      user=mysql

  This causes the server to start as the designated user whether you start it manually or by using *Note `mysqld_safe': mysqld-safe. or

*Note `mysql.server': mysql-server. For more details, see

*Note  changing-mysql-user::.

    这个选项可以使你使用指定的用户帐户启动MySQL,无论是mysqld_safe还是mysql.server命令,都可以使用。

  Running *Note `mysqld': mysqld. as a Unix user other than `root' does not mean that you need to change the `root' user name in the `user' table. _User names for MySQL accounts have nothing to do  with user names for Unix accounts_.

    不要使用Unix的root用户启动并不意味着你要修改MySQL中的user表中的root用户名,因为Unix的root帐户和MySQL的root帐户没有什么关系。所以如果要用想在当下运行启动命令,可使用:

/usr/local/mysql/bin/mysqld -u root start

publish:August 10, 2015 -Monday 

二、MySql Host is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts‘

    此外在使用Mysql时还遇到了这个小问题 MySql Host is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts‘ ,记录一下。错误内容就是:

MySql Host is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts‘

    错误出现的原因:同一个ip在短时间内产生太多(超过mysql数据库max_connection_errors的最大值)中断的数据库连接而导致的阻塞;所以提示你的IP地址:Host XXXXXX is blocked because of many connection errors。

    快速解决方法:进入mysql mysql -u root -p 输入password

    执行命令:flush hosts;  即可。不过这并不是彻底解决问题,只是暂时解决这个问题现象,怎么导致的同一个ip在短时间内产生太多需要自行排查。

publish:August 24, 2015 -Monday

转载请注明来自码农世界,本文标题:《mysql提示Please read “Security“ section of the manual to find out how to run mysqld as root!》

百度分享代码,如果开启HTTPS请参考李洋个人博客
每一天,每一秒,你所做的决定都会改变你的人生!

发表评论

快捷回复:

评论列表 (暂无评论,66人围观)参与讨论

还没有评论,来说两句吧...

Top