Search code examples
mysqlmacos-sierra

Can't create database mysql


Before starting, I would like to point out that this question is not about the problem:

Access denied for user ''@'localhost' to database 'something'

and so, solutions for this or similar problems doesn't work.

I think I messed up with some chmod commands and now, I can log into all the users in my mysql installation but cannot create a database in any user. When I use command:

create database somedatabase;

I get an error saying,

ERROR 1006 (HY000): Can't create database 'somedatabase' (errno: 276999488)

For more information, I don't have a /var/lib/mysql directory but I have a /usr/local/mysql directory. So,

  • Should I use any other commands to identify the actual problem?
  • Have I messed up mysql permissions?

Solution

  • Below solved my problem:

    • sudo chown -RL root:mysql /usr/local/mysql
    • sudo chown -RL mysql:mysql /usr/local/mysql/data
    • sudo /usr/local/mysql/support-files/mysql.server start

    Taken from this SO answer.