[MySQL] Install difficulties : Can't connect to local MySQL server through

Daniel J. Luke dluke at geeklair.net
Tue Jun 26 08:42:27 PDT 2007


On Jun 26, 2007, at 10:19 AM, markd at macports.org wrote:
> I don't think there is an argument against it; it is just that no  
> one has
> done it yet.  It seems like a perfectly acceptable thing to do, but  
> it has
> only been talked about and never done.

I'm not particularly interested in mysql, but creating a potential - 
server portfile took less time than I've already spent on this thread.

This is totally untested, but probably something close to what needs  
to happen:

=== mysql5/Portfile
==================================================================
--- mysql5/Portfile     (revision 26765)
+++ mysql5/Portfile     (local)
@@ -55,34 +55,10 @@
         configure.env   CC=/usr/bin/gcc-4.0 CPP=/usr/bin/cpp-4.0  
CXX=/usr/bin/g++-4.0
  }

-variant server {
-       # Create a startupitem to start/stop the server
-       startupitem.create      yes
-       startupitem.start       "${prefix}/share/mysql5/mysql/ 
mysql.server start"
-       startupitem.stop        "${prefix}/share/mysql5/mysql/ 
mysql.server stop"
-}
-
  pre-destroot {
         # Some directories we must have in all cases
         xinstall -m 755 -d ${destroot}${prefix}/etc/${name}
         destroot.keepdirs-append ${destroot}${prefix}/etc/${name}
-
-       # Setup only for server
-       if { [variant_isset server] } {
-               addgroup ${mysqluser}
-               set gid [existsgroup ${mysqluser}]
-               adduser ${mysqluser} gid=${gid} realname=MySQL\ Server
-
-               # Some directories we must have only if we're running  
as a server
-               xinstall -m 755 -o root -d ${destroot}${prefix}/var/run
-
-               xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
-                       ${destroot}${dbdir} \
-                       ${destroot}${prefix}/var/run/${name}
-               destroot.keepdirs-append  \
-                       ${destroot}${dbdir} \
-                       ${destroot}${prefix}/var/run/${name}
-       }
  }

  post-destroot {
@@ -94,16 +70,6 @@
         }
  }

-post-install {
-       if { [variant_isset server] } {
-               ui_msg  
"******************************************************"
-               ui_msg "* In order to setup the database, you might  
want to run"
-               ui_msg "* sudo -u ${mysqluser} mysql_install_db5"
-               ui_msg "* if this is a new install"
-               ui_msg  
"******************************************************"
-       }
-}
-
  livecheck.check     regex
  livecheck.url       http://dev.mysql.com/
  livecheck.regex     "Generally Available (\[0-9\.\]+)"


new file (mysql5-server/Portfile):

$Id$
PortSystem 1.0

name                    mysql5-server
version                 5.0.41

categories              databases
platforms               darwin

maintainers             nomaintainer at macports.org

description             Run MySQL 5 as a server.
long_description        ${description}

homepage                http://www.mysql.com/
master_sites    http://mysql.mirrors.pair.com/Downloads/MySQL-5.0/ \
                                 http://mysql.he.net/Downloads/ 
MySQL-5.0/ \
                                 http://mysql.orst.edu/Downloads/ 
MySQL-5.0 \
                                 http://mysql.oss.eznetsols.org/ 
Downloads/MySQL-5.0/ \
                                 http://mirrors.sunsite.dk/mysql/ 
Downloads/MySQL-5.0/ \
                                 http://sunsite.informatik.rwth- 
aachen.de/mysql/Downloads/MySQL-5.0/ \
                                 http://ftp.plusline.de/mysql/ 
Downloads/MySQL-5.0/

depends_run             port:mysql5

set dbdir       ${prefix}/var/db/${name}
set mysqluser   mysql

fetch   {}
checksum        {}
extract {}
configure       {}

# Create a startupitem to start/stop the server
startupitem.create      yes
startupitem.start       "${prefix}/share/mysql5/mysql/mysql.server  
start"
startupitem.stop        "${prefix}/share/mysql5/mysql/mysql.server stop"

pre-destroot {
         # Setup only for server
         addgroup ${mysqluser}
         set gid [existsgroup ${mysqluser}]
         adduser ${mysqluser} gid=${gid} realname=MySQL\ Server

         # Some directories we must have only if we're running as a  
server
         xinstall -m 755 -o root -d ${destroot}${prefix}/var/run

         xinstall -m 755 -o ${mysqluser} -g ${mysqluser} -d \
                 ${destroot}${dbdir} \
                 ${destroot}${prefix}/var/run/${name}
         destroot.keepdirs-append  \
                 ${destroot}${dbdir} \
                 ${destroot}${prefix}/var/run/${name}
}

post-install {
         ui_msg "******************************************************"
         ui_msg "* In order to setup the database, you might want to  
run"
         ui_msg "* sudo -u ${mysqluser} mysql_install_db5"
         ui_msg "* if this is a new install"
         ui_msg "******************************************************"
}

livecheck.check     regex
livecheck.url       http://dev.mysql.com/
livecheck.regex     "Generally Available (\[0-9\.\]+)"

--
Daniel J. Luke
+========================================================+
| *---------------- dluke at geeklair.net ----------------* |
| *-------------- http://www.geeklair.net -------------* |
+========================================================+
|   Opinions expressed are mine and do not necessarily   |
|          reflect the opinions of my employer.          |
+========================================================+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://lists.macosforge.org/pipermail/macports-users/attachments/20070626/7eecbfbe/PGP.bin


More information about the macports-users mailing list