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

使用YUM安装MySQL 5.5(适用于CentOS6.2/5.8及Fedora 17/16平台)

[日期:2012-07-12] 来源:Linux社区  作者:叶文涛 [字体:大 中 小]
step6. MySQL 安全设置
  • 设置(修改)root密码
  • 删除匿名用户
  • 禁用root远程登录
  • 删除测试数据库test
  • 重载权限表
要启用MySQL 安全设置请输入以下命令
  1. /usr/bin/mysql_secure_installation  
输出
  1. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL  
  2.       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!  
  3.    
  4.    
  5. In order to log into MySQL to secure it, we\'ll need the current  
  6. password for the root user.  If you\'ve just installed MySQL, and  
  7. you haven\'t set the root password yet, the password will be blank,  
  8. so you should just press enter here.  
  9.    
  10. Enter current password for root (enter for none):   
  11. OK, successfully used password, moving on...  
  12.    
  13. Setting the root password ensures that nobody can log into the MySQL  
  14. root user without the proper authorisation.  
  15.    
  16. Set root password? [Y/n] Y  
  17. New password:   
  18. Re-enter new password:   
  19. Password updated successfully!  
  20. Reloading privilege tables..  
  21.  ... Success!  
  22.    
  23.    
  24. By default, a MySQL installation has an anonymous user, allowing anyone  
  25. to log into MySQL without having to have a user account created for  
  26. them.  This is intended only for testing, and to make the installation  
  27. go a bit smoother.  You should remove them before moving into a  
  28. production environment.  
  29.    
  30. Remove anonymous users? [Y/n] Y  
  31.  ... Success!  
  32.    
  33. Normally, root should only be allowed to connect from 'localhost'.  This  
  34. ensures that someone cannot guess at the root password from the network.  
  35.    
  36. Disallow root login remotely? [Y/n] Y  
  37.  ... Success!  
  38.    
  39. By default, MySQL comes with a database named 'test' that anyone can  
  40. access.  This is also intended only for testing, and should be removed  
  41. before moving into a production environment.  
  42.    
  43. Remove test database and access to it? [Y/n] Y  
  44.  - Dropping test database...  
  45.  ... Success!  
  46.  - Removing privileges on test database...  
  47.  ... Success!  
  48.    
  49. Reloading the privilege tables will ensure that all changes made so far  
  50. will take effect immediately.  
  51.    
  52. Reload privilege tables now? [Y/n] Y  
  53.  ... Success!  
  54.    
  55. Cleaning up...  
  56.    
  57.    
  58.    
  59. All done!  If you\'ve completed all of the above steps, your MySQL  
  60. installation should now be secure.  
  61.    
  62. Thanks for using MySQL!  

【注】:如果您不想启动MySQL 安全设置命令,但至少也得修改一下root用户密码
  1. mysqladmin -u root password [your_password_here]  
  2. ## 示例##  
  3. mysqladmin -u root password myownsecrectpass  
linux
相关资讯       MySQL安装教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

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