Re: mysql8 data dir owner and permissions?

2021-06-21 Thread Bjarne D Mathiesen



Bill Cole wrote:
> On 2021-06-18 at 12:40:30 UTC-0400 (Fri, 18 Jun 2021 12:40:30 -0400)
> Murray Eisenberg 
> is rumored to have said:
> 
>> I have a non-default location for the data dir with mysql8, namely, as
>> specified in my.cnf:
>>
>> datadir = /Users/me/Databases/mysql/data
>>
>> What should the ownership of that directory, and its subdirectories
>> and files, be? And with what permissions?
> 
> The owner needs to be whatever user runs the mysqld process, which
> creates, deletes, reads, and writes files there as a necessary part of
> its operation. That's probably _mysql. That user ALSO needs a path up to
> the root of the filesystem that it can traverse, i.e. that it has search
> permission for. Assuming this 'me' is the same as that for your httpd
> issue, you already have that for /Users and /Users/me.
> 
> No other user needs any access except for whatever is doing your
> backups, which need read access on files & directories and search
> (execute) on directories. That is usually going to be root, so you don't
> need to be concerned about group ownership or other permissions.
> 
>> At the moment, for reasons I do not know, I have:
>>
>> ls -ld /Users/me/Databases/mysql/data
>> drwxr-x--- 91 me  staff 2912 Jun 18 10:18
>> /Users/me/Databases/mysql/data

The reason is probably, that you created this directory as the 'me' user
in order to later use it for your MySQL data. MySQL is on itself unable
to modify the permissions on exiting directories -or- create the needed
ones if the permissions on the enclosing directory is too strong.

> 
> So, 'chown  -R _mysql /Users/me/Databases' should do the trick.
> 

I'd do
sudo chown -R _mysql:_mysql /Users/me/Databases/mysql/data
sudo find -type f /Users/me/Databases/mysql/data -exec 660 {} \;
sudo find -type d /Users/me/Databases/mysql/data -exec 770 {} \;
sudo chown o+x /Users /Users/me /Users/me/Databases
/Users/me/Databases/mysql

-- 
Bjarne D Mathiesen
Korsør ; Danmark ; Europa
---
denne besked er skrevet i et totalt M$-frit miljø
MacPro 2010 ; OpenCore + macOS 10.15.7 Catalina
2 x 3,46 GHz 6-Core Intel Xeon ; 256 GB 1333 MHz DDR3 ECC RDIMM
ATI Radeon RX 590 8 GB


Re: mysql8 data dir owner and permissions?

2021-06-18 Thread Bill Cole

On 2021-06-18 at 12:40:30 UTC-0400 (Fri, 18 Jun 2021 12:40:30 -0400)
Murray Eisenberg 
is rumored to have said:

I have a non-default location for the data dir with mysql8, namely, as 
specified in my.cnf:


datadir = /Users/me/Databases/mysql/data

What should the ownership of that directory, and its subdirectories 
and files, be? And with what permissions?


The owner needs to be whatever user runs the mysqld process, which 
creates, deletes, reads, and writes files there as a necessary part of 
its operation. That's probably _mysql. That user ALSO needs a path up to 
the root of the filesystem that it can traverse, i.e. that it has search 
permission for. Assuming this 'me' is the same as that for your httpd 
issue, you already have that for /Users and /Users/me.


No other user needs any access except for whatever is doing your 
backups, which need read access on files & directories and search 
(execute) on directories. That is usually going to be root, so you don't 
need to be concerned about group ownership or other permissions.



At the moment, for reasons I do not know, I have:

ls -ld /Users/me/Databases/mysql/data
	drwxr-x--- 91 me  staff 2912 Jun 18 10:18 
/Users/me/Databases/mysql/data


And:

[~] % ls -l /Users/me/Databases/mysql/data
 total 709416 [partial listing]
 -rw-r- 1 me staff 196608 Apr 6 10:04 #ib_16384_0.dblwr
-rw-r- 1 me staff 8585216 Feb 4 12:45 #ib_16384_1.dblwr
drwxr-x--- 12 me staff 384 Apr 6 10:02 #innodb_temp
-rw-r- 1 me staff 4982504 Oct 3 2020 mymac.local.err
-rw-r- 1 me staff 4 Apr 6 10:02 mymac.pid
drwxr-x--- 23 me staff 736 Oct 3 2020 Math421Blog
-rw-r-@ 1 me staff 56 Oct 25 2018 auto.cnf
-rw-r- 1 me staff 179 Mar 7 22:47 binlog.003746
:
-rw-r- 1 me staff 864 Apr 6 10:02 binlog.index
-rw--- 1 me staff 1680 Jan 2 2020 ca-key.pem
-rw-r--r-- 1 me staff 1112 Jan 2 2020 ca.pem
-rw-r--r-- 1 me staff 1112 Jan 2 2020 client-cert.pem
-rw--- 1 me staff 1676 Jan 2 2020 client-key.pem
-rw-r- 1 me staff 5175 Apr 5 23:15 ib_buffer_pool
-rw-r- 1 me staff 50331648 Apr 6 10:04 ib_logfile0
-rw-r- 1 me staff 50331648 Feb 5 12:55 ib_logfile1
-rw-r- 1 me staff 79691776 Apr 6 21:01 ibdata1
-rw-r- 1 me staff 12582912 Apr 6 10:02 ibtmp1
drwxr-x--- 8 me staff 256 Feb 4 12:45 mysql
-rw-r- 1 me staff 46137344 Apr 6 10:02 mysql.ibd
-rw-r- 1 me staff 6 Feb 4 12:45 mysql_upgrade_info
drwxr-x--- 111 me staff 3552 Feb 4 12:45 performance_schema
drwxr-x--- 21 me staff 672 Oct 3 2020 phpmyadmin
-rw--- 1 me staff 1680 Jan 2 2020 private_key.pem
-rw-r--r-- 1 me staff 452 Jan 2 2020 public_key.pem
drwxr-x--- 29 me staff 928 Oct 3 2020 sakila
-rw-r--r-- 1 me staff 1112 Jan 2 2020 server-cert.pem
-rw--- 1 me staff 1676 Jan 2 2020 server-key.pem
drwxr-x--- 3 me staff 96 Oct 3 2020 sys
-rw-r- 1 me staff 80740352 Apr 6 10:04 undo_001
-rw-r- 1 me staff 29360128 Feb 5 21:01 undo_002


So, 'chown  -R _mysql /Users/me/Databases' should do the trick.

--
Bill Cole
b...@scconsult.com or billc...@apache.org
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire


mysql8 data dir owner and permissions?

2021-06-18 Thread Murray Eisenberg
I have a non-default location for the data dir with mysql8, namely, as 
specified in my.cnf:

datadir = /Users/me/Databases/mysql/data

What should the ownership of that directory, and its subdirectories and files, 
be? And with what permissions?

At the moment, for reasons I do not know, I have:

ls -ld /Users/me/Databases/mysql/data
drwxr-x--- 91 me  staff 2912 Jun 18 10:18 /Users/me/Databases/mysql/data

And:

[~] % ls -l /Users/me/Databases/mysql/data 
 total 709416 [partial listing]
 -rw-r- 1 me staff 196608 Apr 6 10:04 #ib_16384_0.dblwr 
-rw-r- 1 me staff 8585216 Feb 4 12:45 #ib_16384_1.dblwr 
drwxr-x--- 12 me staff 384 Apr 6 10:02 #innodb_temp 
-rw-r- 1 me staff 4982504 Oct 3 2020 mymac.local.err 
-rw-r- 1 me staff 4 Apr 6 10:02 mymac.pid 
drwxr-x--- 23 me staff 736 Oct 3 2020 Math421Blog 
-rw-r-@ 1 me staff 56 Oct 25 2018 auto.cnf 
-rw-r- 1 me staff 179 Mar 7 22:47 binlog.003746 
: 
-rw-r- 1 me staff 864 Apr 6 10:02 binlog.index 
-rw--- 1 me staff 1680 Jan 2 2020 ca-key.pem 
-rw-r--r-- 1 me staff 1112 Jan 2 2020 ca.pem 
-rw-r--r-- 1 me staff 1112 Jan 2 2020 client-cert.pem 
-rw--- 1 me staff 1676 Jan 2 2020 client-key.pem 
-rw-r- 1 me staff 5175 Apr 5 23:15 ib_buffer_pool 
-rw-r- 1 me staff 50331648 Apr 6 10:04 ib_logfile0 
-rw-r- 1 me staff 50331648 Feb 5 12:55 ib_logfile1 
-rw-r- 1 me staff 79691776 Apr 6 21:01 ibdata1 
-rw-r- 1 me staff 12582912 Apr 6 10:02 ibtmp1 
drwxr-x--- 8 me staff 256 Feb 4 12:45 mysql 
-rw-r- 1 me staff 46137344 Apr 6 10:02 mysql.ibd 
-rw-r- 1 me staff 6 Feb 4 12:45 mysql_upgrade_info 
drwxr-x--- 111 me staff 3552 Feb 4 12:45 performance_schema 
drwxr-x--- 21 me staff 672 Oct 3 2020 phpmyadmin 
-rw--- 1 me staff 1680 Jan 2 2020 private_key.pem 
-rw-r--r-- 1 me staff 452 Jan 2 2020 public_key.pem 
drwxr-x--- 29 me staff 928 Oct 3 2020 sakila 
-rw-r--r-- 1 me staff 1112 Jan 2 2020 server-cert.pem 
-rw--- 1 me staff 1676 Jan 2 2020 server-key.pem 
drwxr-x--- 3 me staff 96 Oct 3 2020 sys 
-rw-r- 1 me staff 80740352 Apr 6 10:04 undo_001 
-rw-r- 1 me staff 29360128 Feb 5 21:01 undo_002
:


---
Murray Eisenbergmurrayeisenb...@gmail.com
503 King Farm Blvd #101 
Rockville, MD 20850-6667Mobile (413)-427-5334