Home>

Previously, while trying to resolve the mysql server not starting
Link
Execute the "sudo chown -R _mysql: _mysql/usr/local/var/mysql" command according to the above website, and under/usr/local/var/mysql /
I changed the owner of all files to _mysql, but after that, when I try to create/delete files under/usr/local/var/mysql/or execute commands, I get a permission denied error. became. What should i do?

Error code
tail -f /usr/local/var/mysql/〇〇〇.err
tail: /usr/local/var/mysql/〇〇〇.err: Permission denied
code
ls -l/usr/local/var/mysql /
total 353584
-rw-r----- 1 _mysql _mysql 196608 10 16 09:14 # ib_16384_0.dblwr
-rw-r----- 1 _mysql _mysql 8585216 10 12 14:38 # ib_16384_1.dblwr
drwxr-x --- 12 _mysql _mysql 384 10 16 09:12 #innodb_temp
-rw-r----- 1 _mysql _mysql 110039 10 15 23:18 〇〇〇.err
-rw-r----- 1 _mysql _mysql 22966 10 16 09:12 〇〇〇.local.err
-rw-r----- 1 _mysql _mysql 5 10 16 09:12 〇〇〇.local.pid
-rw-r----- 1 _mysql _mysql 56 10 12 14:38 auto.cnf
-rw-r----- 1 _mysql _mysql 179 10 12 14:40 binlog.000001
-rw-r----- 1 _mysql _mysql 179 10 12 14:52 binlog.000002
-rw-r----- 1 _mysql _mysql 200 10 12 14:53 binlog.000003
-rw-r----- 1 _mysql _mysql 200 10 12 14:53 binlog.000004
-rw-r----- 1 _mysql _mysql 179 10 12 14:53 binlog.000005
-rw-r----- 1 _mysql _mysql 179 10 12 15:05 binlog.000006
-rw-r----- 1 _mysql _mysql 643 10 13 21:02 binlog.000007
-rw-r----- 1 _mysql _mysql 179 10 13 21:02 binlog.000008
-rw-r----- 1 _mysql _mysql 179 10 13 21:07 binlog.000009
-rw-r----- 1 _mysql _mysql 179 10 13 21:18 binlog.000010
-rw-r----- 1 _mysql _mysql 179 10 13 22:21 binlog.000011
-rw-r----- 1 _mysql _mysql 179 10 13 22:54 binlog.000012
-rw-r----- 1 _mysql _mysql 179 10 14 09:09 binlog.000013
-rw-r----- 1 _mysql _mysql 179 10 14 09:11 binlog.000014
-rw-r----- 1 _mysql _mysql 179 10 14 09:13 binlog.000015
-rw-r----- 1 _mysql _mysql 179 10 14 09:15 binlog.000016
-rw-r----- 1 _mysql _mysql 179 10 14 15:46 binlog.000017
-rw-r----- 1 _mysql _mysql 179 10 14 15:47 binlog.000018
-rw-r----- 1 _mysql _mysql 156 10 16 09:12 binlog.000019
-rw-r----- 1 _mysql _mysql 156 10 16 09:12 binlog.000020
-rw-r----- 1 _mysql _mysql 320 10 16 09:12 binlog.index
-rw ------- 1 _mysql _mysql 1680 10 12 14:38 ca-key.pem
-rw-r--r-- 1 _mysql _mysql 1112 10 12 14:38 ca.pem
-rw-r--r-- 1 _mysql _mysql 1112 10 12 14:38 client-cert.pem
-rw ------- 1 _mysql _mysql 1676 10 12 14:38 client-key.pem
-rw-r----- 1 _mysql _mysql 3330 10 14 15:47 ib_buffer_pool
-rw-r----- 1 _mysql _mysql 50331648 10 16 09:14 ib_logfile0
-rw-r----- 1 _mysql _mysql 50331648 10 12 14:38 ib_logfile1
-rw-r----- 1 _mysql _mysql 12582912 10 16 09:12 ibdata1
-rw-r----- 1 _mysql _mysql 12582912 10 16 09:12 ibtmp1
drwxr-x --- 8 _mysql _mysql 256 10 12 14:38 mysql
-rw-r----- 1 _mysql _mysql 25165824 10 16 09:12 mysql.ibd
drwxr-x --- 107 _mysql _mysql 3424 10 12 14:38 performance_schema
-rw ------- 1 _mysql _mysql 1676 10 12 14:38 private_key.pem
-rw-r--r-- 1 _mysql _mysql 452 10 12 14:38 public_key.pem
-rw-r--r-- 1 _mysql _mysql 1112 10 12 14:38 server-cert.pem
-rw ------- 1 _mysql _mysql 1680 10 12 14:38 server-key.pem
drwxr-x --- 3 _mysql _mysql 96 10 12 14:38 sys
-rw-r----- 1 _mysql _mysql 10485760 10 16 09:14 undo_001
-rw-r----- 1 _mysql _mysql 10485760 10 12 14:40 undo_002
What I tried

chown (your name): staff/usr/local/var/mysql /
It doesn't react for some reason. (The result does not change even if the sudo command is added)
When you run chown (your name): staff /usr/local/var/mysql/ (your name) .err
Operation not permitted is displayed and cannot be changed.

  • Answer # 1

    I'm not sure about the situation,_mysqlIf you want to see your own filessu _mysqlSo, I think you should switch users and work.

  • Answer # 2

    sudo chown -R xxxx: xxxx/usr/local/var/mysql /
    It was solved in. Thank you very much.