美文网首页
centos 7 mysql 5.7修改my.cnf配置不生效问

centos 7 mysql 5.7修改my.cnf配置不生效问

作者: JackSpeed | 来源:发表于2019-10-12 16:53 被阅读0次

    mysql5.7默认lower_case_table_names=1,event_scheduler=OFF
    原来的my.cnf在/etc/目录下,当修改lower_case_table_names=1和开启数据库事件event_scheduler=ON后,

    use mysql;
    show variables like "%table_names%";
    show variables like "%event%";
    

    查询结果依然还是
    lower_case_table_names=1,event_scheduler=OFF


    解决办法是
    把配置文件复制到mysql安装目录的根目录,当前机器目录是/usr/local/
    于是:
    cp /etc/my.cng /usr/local/mysql/my.cnf
    进入目录之后文件列表

    [root@---------    home]# cd /usr/local/mysql/
    [root@---------   mysql]# ll
    total 60
    drwxr-xr-x  2  7161 wheel  4096 Feb  2  2016 bin
    -rw-r--r--  1  7161 wheel 17987 Feb  2  2016 COPYING
    drwxr-xr-x 20 mysql mysql  4096 Sep 17 16:17 data
    drwxr-xr-x  2  7161 wheel  4096 Feb  2  2016 docs
    drwxr-xr-x  3  7161 wheel  4096 Feb  2  2016 include
    drwxr-xr-x  5  7161 wheel  4096 Feb  2  2016 lib
    drwxr-xr-x  4  7161 wheel  4096 Feb  2  2016 man
    -rwxr-xr-x  1 root  root     76 Sep 17 16:17 my.cnf
    -rw-r--r--  1  7161 wheel  2478 Feb  2  2016 README
    drwxr-xr-x 28  7161 wheel  4096 Feb  2  2016 share
    drwxr-xr-x  2  7161 wheel  4096 Feb  2  2016 support-files
    
    

    my.cnf文件内容为:

    
    [mysqld]
    #mysql新配置文件
    event_scheduler=ON
    lower_case_table_names=1
    
    

    再次查询,修改已经生效

    相关文章

      网友评论

          本文标题:centos 7 mysql 5.7修改my.cnf配置不生效问

          本文链接:https://www.haomeiwen.com/subject/fllcuctx.html