How to fix [Errno 13] Permission denied error on MySQL

Techie-stronaut
2 min readOct 12, 2023

--

When i tried to start my MySQL server, it shows me this error.

Could not open error log file: [Errno 13] Permission denied: /usr/local/mysql/data/mysqld.local.err 2023–10–12 22:49:51 — Command to start the server is not configured. Please set the command that must be used to start the server in the remote management section of this connections settings.

It simly means that there is no Permission on my folder /usr/local/mysql/data/mysqld.local.err. then how can i fix this?

1) Check the Ownership and Permissions

First, let’s check the ownership and permissions on the /usr/local/mysql/data/ directory. Open the Terminal and run:

ls -la /usr/local/mysql/data/

It showed me Permission denied error at that time, that means that i don’t have permission for this folder

2) Change Ownership

If the ownership is not set to the MySQL user, you can change it using the chown command. This command needs to be executed with superuser privileges:

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

Here, -R is used to recursively change the ownership of all files and directories under /usr/local/mysql/data/.

3) Adjust Permissions

sudo chmod -R 755 /usr/local/mysql/data/

This will set read, write, and execute permissions for the owner, and read and execute permissions for the group and others.

4) Start the MySQL Server

Once the permissions and ownership are corrected, try starting the MySQL server:

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

Then finally, we can start the MySQL server!

Reference : chatgpt4

--

--

Techie-stronaut

IT Support since 2024 | IT Support | Python | Java | Spring. Write what i've learnt everyday! https://www.linkedin.com/in/yeachan-shin-276074261/