Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Mar 2021 11:48:30 -0600
From:      Gary Aitken <freebsd@dreamchaser.org>
To:        "John R. Levine" <johnl@iecc.com>, freebsd-questions@freebsd.org
Subject:   Re: problems upgrading mysql 5.6 => 5.7 (SOLVED)
Message-ID:  <6845a7af-c8fa-dc0d-5ba0-c735bc8aadeb@dreamchaser.org>
In-Reply-To: <64d150fd-9de-dacf-d88b-2dc57addaf15@iecc.com>
References:  <20210321235845.E3B5870DD030@ary.qy> <5ec345c3-01a6-f959-0971-5836ecc85e20@dreamchaser.org> <64d150fd-9de-dacf-d88b-2dc57addaf15@iecc.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 3/22/21 5:42 PM, John R. Levine wrote:
>>> If you're using the mysql-server package, Mysql runs as the mysql
>>> user, user ID 88, and all of its data files should belong
>>> to mysql.
>>>
>>> Unless you really REALLY know what you are doing, nothing but mysql should be
>>> writing the files in its database directory so nobody else should have write access to it.
>>
>> Well, I really *don't* know what I'm doing...
>> I always started mysqld from a user account.  I didn't pay attention to the
>> owner/protections on the files, just set the data dir, and at one point I
>> changed the permissions of everything in that account to 600; I may have
>> forced the owner/group as well.  I knew mysqld ran as mysql but I thought it
>> only did that when started by root.
> 
> Assuming you have superuser access to your freebsd box, I think you will find that things work better when you run them the way they expect to be run.  The mysql-server script expects to he run by root, usually at system startup, and then switch to the mysql user.

It turns out the problem had little to do with permissions or the account
used to start the server, and everything to do with mysql 5.7 default
specifications/changes.

/usr/local/etc/mysql/my.cnf for 5.7 specifies:
   innodb_data_file_path           = ibdata1:128M:autoextend
and the file in my datadir was smaller.
My ibdata1 file had size 27262976
   1024 * 1024 = 1048576
   27262976 / 1048576 = 26
I had to add the following to ~/.my.cnf:
   innodb_data_file_path=ibdata1:26M:autoextend
   innodb_temp_data_file_path=ibtmp1:26M:autoextend
   innodb_data_home_dir=/usr/home/me/mysql_data
   innodb_log_group_home_dir=/usr/home/me/mysql_data
The server then starts up fine from a normal user account using a data dir
with owner/group of user:user and file permissions of 600.

I found this in the following bug report:
   https://bugs.mysql.com/bug.php?id=96497

Gary



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6845a7af-c8fa-dc0d-5ba0-c735bc8aadeb>