Creating database access denied

6,134

This is because mysql user does not have permissions to access your datadir. Please execute the below command to fix the issue :

sudo chown -R mysql:mysql /var/lib/mysql 

Note : I am assuming that your datadir is /var/lib/mysql.

Share:
6,134

Related videos on Youtube

stack
Author by

stack

Updated on September 18, 2022

Comments

  • stack
    stack almost 2 years

    Here is what I've done:

    user@name /my/path # mysql -u root -p<myPassword>  
    mysql> create database spy;
    ERROR 13 (HY000): Can't get stat of './spy' (Errcode: 13 - Permission denied)
    

    How can I fix it?

    Noted that this also happens:

    mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost';
    ERROR 29 (HY000): File './mysql/user.MYD' not found (Errcode: 13 - Permission denied)