Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

前端 未结 18 2311
轮回少年
轮回少年 2020-12-04 15:29

I am on a server that has afresh install on RHEL 5. I was able to install Apache and PHP just fine., but I am having serious trouble with my MySQL installation. I tried t

18条回答
  •  佛祖请我去吃肉
    2020-12-04 15:58

    The root of my problem seemed to be selinux, which was turned on (enforcing) automatically on OS install.

    I wanted my mysql in /data.

    After verifying that my.cnf had:

    datadir=/data/mysql
    

    (and leaving the socket at /var/lib/mysql) I executed the command to turn off selinux for mysqld (alternative is to turn it off completely):

    setsebool -P mysqld_disable_trans=1
    

    I ran the following commands:

    > chown -R mysql .
    > chgrp -R mysql .
    > mysql_install_db --user=mysql
    

    I started the mysql daemon and everything worked fine after that.

提交回复
热议问题