I have never been particularly great about the MySql shutdown procedure.

I believe this is the correct method:
    /opt/local/bin/mysqladmin5 -u root -p shutdown

This will allow all tables to close up clean, any insert delayed's will have 
time to finish, and MySql will be in a state that is actually shut down without 
any data loss.  Or so that is how it is supposed to work.

What do I usually do? `sudo reboot`
At least on my dev machine, which of course, does not do much harm.

I am more and more trying to use the `port load` and `port unload` commands, 
because they are convenient, and simple to remember.

First question:
Does `port contents` always omit plist files, aka launchd scripts from output?
    $file /Library/LaunchDaemons/org.macports.mysql5.plist 
    /Library/LaunchDaemons/org.macports.mysql5.plist: XML  document text

    $port contents mysql5 | grep macports
    > Nothing returned

Looking at:
    /Library/LaunchDaemons/org.macports.mysql5.plist
Do the contents of those files mean I am to use `port start mysql5` and `port 
stop mysql5` and `port restart mysql5`?  It does not seem to work, 
"Unrecognized action stop".

But `sudo port unload mysql5` does work, however, it did not ask me for a MySql 
password, which means it did not run `mysqladmin5 -u root -p shutdown`, correct?

The plist calls
    /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper
which does *not* have the word 'shutdown' in it anywhere, which the stop 
command calls
    /opt/local/share/mysql5/mysql/mysql.server stop
But looking over that code, I see nothing to ensure me I am getting a clean 
shutdown.

    $/opt/local/bin/mysqladmin5 -u root -p shutdown
    Enter password: 
    $mysql5 -u root -p  // Try to connect, should not be able to...
    Enter password: 
    ERROR 2002 (HY000): Can't connect to local MySQL server through 
    socket '/opt/local/var/run/mysql5/mysqld.sock' (2)
Using my "normal" method I have tried to remember to use, seems to indeed stop 
it.  Not sure if and when launchd is going to come back along and bring it back 
up, any ideas on that one?

I guess the correct thing to do is going to be:
    $sudo port unload mysql5
    $/opt/local/bin/mysqladmin5 -u root -p shutdown

That will keep launchd from getting back up again, and it will stop mysql5 
cleanly?  But then I have to `sudo port load mysql5` after the machine comes 
back up, and Apache will more than likely already started to serve errors if it 
is a live server.  This being because the MySql launchd item was unloaded.

If all this is correct, what in the heck is 
/opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper for anyway?

Is there any way to get the `port unload` for MySql to be more specific to the 
needs of MySql in regards to shutdown?  What are the suggested methods for 
making sure when you issue a Finder based restart, shutdown, or CLI based 
`reboot`, that MySql cleanly goes away, or is it always assumed an admin will 
take steps to take a system down in an orderly way?

I have read this over twice now:
    http://dev.mysql.com/doc/refman/5.1/en/server-shutdown.html
and I believe _maybe_ that is saying that `port unload` will in fact be a safe 
way to shut down, but it is not 100% clear to me either.

Oh, also, on a non MacPorts system, with MySql installed from MySql's binary 
installer for Mac OS X I have files put into /usr/local/mysql with data in 
/usr/local/mysql/data

    Permissions on /usr/local/mysql/data are:
    drwxr-x---  76 mysql  wheel   2584 31 Dec  1969 data

MacPorts has a layout of /opt/local/var/db/mysql5 with all db files right 
there.  I can `cd` into the directory in which all the data files are, which on 
the non MacPorts system, permissions prevent me from doing so.

MacPorts:
    drwxr-xr-x  8 _mysql  _mysql  272 Mar  4 23:52 mysql5
MySql Binary Installer Mac OS X
    drwxr-x---  76 mysql  wheel   2584 31 Dec  1969 data

Am I reading the MySql docs wrong about layout at ( 
http://dev.mysql.com/doc/refman/5.0/en/installation-layouts.html ) ?

It would seem to me that MacPorts "mysql5" should be named "data", or I would 
take it one deeper and add "data" a level down: /opt/local/var/db/mysql5/data

The binary installer seems to be a little cleaner:
    /usr/local/mysql/scripts/mysql_install_db5
     - versus - 
    /opt/local/bin/mysql_install_db5

Is there any reason to not do something like:
/opt/local/bin/mysql/scripts/mysql_install_db5

As well as the same for "sql-bench" (which I can not even find), and everything 
else that MySql installs.

I know it is a long email, but I got involved in a problem, and these are the 
things I ran into along the way.

* If any of my paths are off a bit, I apologize, I have a feeling most of you 
are going to get what I am after here. 

** Did the MySql socket location change, or something else with regards to php, 
mysql, and apache, as I absolutely had to edit php.ini to get it to work.  
phpInfo() had no default socket set. Or is that still part of ( 
https://trac.macports.org/ticket/21250 ) and we are just not get to see 
resolution to that ticket?

Thank you.

-- 
Scott * If you contact me off list replace talklists@ with scott@ * 

_______________________________________________
macports-users mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-users

Reply via email to