zoukankan      html  css  js  c++  java
  • (3.5)mysql基础深入——mysqld_safe脚本功能及流程

    (3.5)mysql基础深入——mysqld_safe脚本功能及流程

    目录 

    1、mysqld_safe过程总结

    2、mysql_safe启动的好处

    3、mysqld_safe 参数

    4、mysqld_safe流程

    详情:

    1、mysqld_safe过程总结

      【1.1】检查环境变量  【1.2】检查配置文件中的选项  【1.3】启动mysqld及启动后的一些处理

    2、mysql_safe启动的好处

      【2.1】安全性好(出现问题重启的时候,会向错误日志里面写入相关运行时间)

      【2.2】启动时指定一些关于mysqld_safe的参数,也可以放在my.cnf里的 [mysqld_safe]

      【2.3】ulimit -c $core_file_size(文件大小)

      【2.4】unlimit -n $size(最多支持的打开文件数量)

      【2.5】检查环境变量,检查配置文件,检查指定的选项

    3、mysqld_safe 参数

      

     --no-defaults              Don't read the system defaults file
      --defaults-file=FILE       Use the specified defaults file
      --defaults-extra-file=FILE Also use defaults from the specified file
    
     Other options:
      --ledir=DIRECTORY          Look for mysqld in the specified directory
      --open-files-limit=LIMIT   Limit the number of open files
      --core-file-size=LIMIT     Limit core files to the specified size
      --timezone=TZ              Set the system timezone
      --malloc-lib=LIB           Preload shared library LIB if available
      --mysqld=FILE              Use the specified file as mysqld
      --mysqld-version=VERSION   Use "mysqld-VERSION" as mysqld
      --nice=NICE                Set the scheduling priority of mysqld
      --plugin-dir=DIR           Plugins are under DIR or DIR/VERSION, if
                                 VERSION is given
      --skip-kill-mysqld         Don't try to kill stray mysqld processes
      --syslog                   Log messages to syslog with 'logger'
      --skip-syslog              Log messages to error log (default)
      --syslog-tag=TAG           Pass -t "mysqld-TAG" to 'logger'
      --mysqld-safe-log-         TYPE must be one of UTC (ISO 8601 UTC),
        timestamps=TYPE          system (ISO 8601 local time), hyphen
                                 (hyphenated date a la mysqld 5.6), legacy
                                 (legacy non-ISO 8601 mysqld_safe timestamps)

    4、mysqld_safe流程

    【4.1】查看basedir和ledir

    【4.2】查看datadir和my.cnf

    【4.3】对my.cnf做一些检查

    【4.4】解析My.cnf中的组 [mysqld] 和 [mysqld_safe] 并和中毒案例输入的命令合并。

    【4.5】调用parse_arguments函数解析用户传递(就是【4】中的)的所有参数($@)

    【4.6】对系统日志和错误日志的判断和做出相应的处理,及选项--err-log参数的复制。

    【4.7】对选项--user , --pid-file , --socket 及 --port 进行处理及复制,保证启动时如果不给出这些参数也会有值。

    【4.8】启动mysqld

      (1)启动时会判断一个进程号是否存在,如果存在那么久在错误日志中记录 "A mysqld process already exists" 并且退出

      (2)如果不存在就删除进程文件,如果删除不了,那么久在错误日志中记录 "Fatal error : Can't remove the pid file" 并退出。

    【4.9】启动时对表进行检查。如果启动的时候检查表的话设置key_buffer and sort_buffer 会提高速度并且减少磁盘空间的使用。

    【4.10】如果启动时什么参数都没有显示指定,那么它会选用一些特定的参数,具体参数看【3】

    【4.11】如果服务器异常关闭,那么会restart。

  • 相关阅读:
    Spring常见面试题
    Mybatis常见面试题
    SQLSERVER查询整个数据库中某个特定值所在的表和字段的方法
    四款常见数据库比较同步软件汇总
    SQL Server常用函数整理
    比较经典的SQL面试题
    sqlserver查询数据库中有多少个表
    数据库设计三大范式
    MS SQL SERVER导出表结构到Excel
    flask-vue 解决跨域问题
  • 原文地址:https://www.cnblogs.com/gered/p/10555325.html
Copyright © 2011-2022 走看看