MacOS Can't start MySQL Server

后端 未结 9 901
甜味超标
甜味超标 2021-02-13 03:58

I have MacOS Sierra. I have installed MySQL Server which has been working, however, after a reboot of the Mac Book, I cannot start the MySQL Server.

I have trie

相关标签:
9条回答
  • 2021-02-13 04:29

    In my case, ownership of the msyql directory had somehow changed to admin:admin. I use ares suggestion to run mysqld from the terminal:

    sudo /usr/local/mysql/support-files/mysql.server start
    

    Which showed a permissions error writing to a msyql file.

    I fixed with this command:

    sudo chown -R _mysql:wheel /usr/local/mysql/data
    

    from this post:

    What user should own /usr/local/mysql on Mac?

    0 讨论(0)
  • 2021-02-13 04:32

    After a discussion with Richard, the following solves the issue:

    my.cnf:

    [client]
    
    port = 3306
    socket = /tmp/mysql.sock
    
    
    [mysqld]
    
    port = 3306
    socket = /tmp/mysql.sock
    datadir = /usr/local/mysql-5.7.17-macos10.12-x86_64/data
    tmpdir = /tmp
    

    Essentially, although we'd added the relevant stanza's to the my.cnf file, we'd still missed the section heading. Adding the [mysqld] section allowed mysql to start.

    0 讨论(0)
  • 2021-02-13 04:33

    My problem was that due to an incorrect restart of my machine, a database was corrupted. According to their docs doing a forced InnoDB Recovery did the trick:

    /etc/my.cnf
    
    innodb_force_recovery = 2
    
    0 讨论(0)
  • 2021-02-13 04:35

    I suggest to use Terminal commands.

    Start MySQL

    sudo /usr/local/mysql/support-files/mysql.server start

    Stop MySQL

    sudo /usr/local/mysql/support-files/mysql.server stop

    Restart MySQL

    sudo /usr/local/mysql/support-files/mysql.server restart

    0 讨论(0)
  • 2021-02-13 04:36

    In my case, I had inadvertently transferred ownership of entire /usr/local directory to myself, which resulted in snatching-away of write permission of /usr/local/mysql-5.7.20-macos10.12-x86_64/data directory from the daemon user called "_mysql".

    Restoring the ownership fixed the issue.

    0 讨论(0)
  • 2021-02-13 04:36

    My problem was that I installed MySQL a while ago with Homebrew (forgot I did) and then went the more manual route, so I think the two installs were fighting each other. I wiped my Mac of both with the help of this walkthrough: https://gist.github.com/vitorbritto/0555879fe4414d18569d

    Note: Where it says to use subl - that's Sublime, use whatever editor you like.

    I was able to get things to work with a fresh install after that.

    0 讨论(0)
提交回复
热议问题