can't start mysql56 after move datadir

Bradley Giesbrecht pixilla at macports.org
Thu Feb 12 15:48:58 PST 2015


I am not familiar with mysql.server but using the mysql56-server port to start and stop mysqld works as expected:

sudo port install mysql56-server
sudo port load mysql56-server
/opt/local/lib/mysql56/bin/mysql -S /opt/local/var/run/mysql56/mysqld.sock -uroot -p -e 'show variables like "datadir";'
# Enter password: 
# +---------------+----------------------------+
# | Variable_name | Value                      |
# +---------------+----------------------------+
# | datadir       | /opt/local/var/db/mysql56/ |
# +---------------+----------------------------+
# sudo port unload mysql56-server
sudo mv /opt/local/var/db/mysql56 /Users/brad/
sudo mv /opt/local/etc/mysql56/my{,-orig}.cnf
sudo sh -c 'cat > /opt/local/etc/mysql56/my.cnf' << EOF
[mysqld]
datadir     = /Users/brad/mysql56
EOF
sudo port load mysql56-server
/opt/local/lib/mysql56/bin/mysql -S /opt/local/var/run/mysql56/mysqld.sock -uroot -p -e 'show variables like "datadir";'
# Enter password: 
# +---------------+----------------------+
# | Variable_name | Value                |
# +---------------+----------------------+
# | datadir       | /Users/brad/mysql56/ |
# +---------------+----------------------+
# sudo port unload mysql56-server
sudo mv /opt/local/etc/mysql56/my{-orig,}.cnf
sudo mv /Users/brad/mysql56 /opt/local/var/db/



Regards,
Bradley Giesbrecht (pixilla)



On Feb 12, 2015, at 2:34 PM, Murray Eisenberg <murrayeisenberg at gmail.com> wrote:

> CORRECTION:  The command I use to start the mysql server is indeed the one for the Macports version, namely:
> 
>   sudo /opt/local/share/mysql56/support-files/mysql.server start
> 
> (Sorry for the typo.)
> 
>> On 12 Feb2015, at 5:05 PM, Murray Eisenberg <murrayeisenberg at gmail.com> wrote:
>> 
>> After upgrading from OS X Mavericks to Yosemite, I did the standard procedure for migrating macports. But I found that the mysql server would not start. So I uninstalled mysql56 completely and installed anew. Worked just fine.
>> 
>> But, I want my datadir to be someplace else from the default, so I edited my.cnf as shown below, then did an _exact_ copy (* preserving permissions *) of /opt/local/var/db/mysql56 to new location ~/Databases/mysql/data, i.e.,
>> /Volumes/MacHD/Users/thisuser/Databases/mysql/data.
>> 
>> When I execute
>> 
>>  sudo /usr/local/mysql/support-files/mysql.server start
>> 
>> now I get the dreaded message
>> 
>>  Starting MySQL
>> . ERROR! The server quit without updating PID file (/Volumes/MacHD/Users/thisuser/Databases/mysql/data/MyMachineName.local.pid).
>> 
>> In MyMachineName.local.err, I see the following:
>> 
>> ===== extract from [MyMachineName].local.err ======
>> 
>> 150212 16:53:28 mysqld_safe mysqld from pid file /Volumes/MacHD/Users/thisuser/Databases/mysql/data/MyMachineName.local.pid ended
>> 150212 16:59:05 mysqld_safe Starting mysqld daemon with databases from /Volumes/MacHD/Users/thisuser/Databases/mysql/data
>> 2015-02-12 16:59:05 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
>> 2015-02-12 16:59:05 82301 [Warning] Setting lower_case_table_names=2 because file system for /Volumes/MacHD/Users/thisuser/Databases/mysql/data/ is case insensitive
>> 150212 16:59:06 mysqld_safe mysqld from pid file /Volumes/MacHD/Users/thisuser/Databases/mysql/data/MyMachineName.local.pid ended
>> 
>> ==== end extract =======
>> 
>> So the mysql server does seem to be using the datadir I specified. And the ownership on this datadir are the same (_mysql:_mysql) as on /opt/local/var/db/mysql56.
>> 
>> What's wrong?
>> 
>> Below is my /opt/local/etc/mysql56/my.cnf.
>> 
>> 
>>  ========== begin file my.cnf ===========
>> 
>> # Use default MacPorts settings
>> !include /opt/local/etc/mysql56/macports-default.cnf
>> 
>> [mysqld]
>> datadir = /Volumes/MacHD/Users/thisuser/Databases/mysql/data 
>> port = 3306
>> socket = /opt/local/var/run/mysql56/mysqld.sock
>> 
>> sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 
>> 
>> [client]
>> socket = /opt/local/var/run/mysql56/mysqld.sock
>> 
>>   ============ end file =============
>> ---
>> Murray Eisenberg		murrayeisenberg at gmail.com
>> 503 King Farm Blvd #101		Home (240)-246-7240
>> Rockville, MD 20850-6667	Mobile (413)-427-5334

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.macosforge.org/pipermail/macports-users/attachments/20150212/b60f709c/attachment.sig>


More information about the macports-users mailing list