mysqld vs. mysql-server

Ryan Schmidt ryandesign at macports.org
Mon Feb 25 14:02:40 PST 2013


On Feb 25, 2013, at 15:48, Murray Eisenberg <murrayeisenberg at gmail.com> wrote:

> On 25 Feb 2013 08:07:54 -0700, Chris Janton <face at centosprime.com> wrote:
> 
>> On 2013-02-25 , at 07:24 , Murray Eisenberg <murrayeisenberg at gmail.com> wrote:
>>> 
>>> After I install the port mysql55-server, I have among other things binaries
>>> 
>>> /opt/local/lib/mysql55/bin/mysqld
>>> /opt/local/share/mysql55/support-files/mysql.server
>>> 
>>> What's the difference? 
>> 
>> mysql.server isn't a binary - it is a shell script.
>> 
>> Looking into the contents it appears to be the start/stop/restart tool for Linux-like systems.
>> 
>> The macports version of start/stop is done with launchd and daemondo - that's what the
>> 
>> port load/unload
>> 
>> commands do.
>> 
>> I don't think the mysql.server file is actually used in a typical Mac OS X environment.
> 
> I asked about mysql.server because that's what is described in Step 3 of "Install and configure MySQL" at http://muddledramblings.com/rumblings-from-the-secret-labs/lamp-server-from-scratch-with-macports/.
> In fact, the procedure there is to create an alias for invoking that script.
> 
> Perhaps my confusion involves the difference between loading mysql for use within apache with php, on the one hand, and just starting mysql for more direct or non-browser access.

You're talking about two different things.

There is a MySQL server that you run on some machine. It serves databases that you can use for whatever purposes you want. The MySQL server program is called mysqld ("the MySQL Daemon"). The mysqld program itself, and all other programs and libraries that make up MySQL, are in the mysql51 or mysql55 or mariadb or percona or mysql5 ports (depending on which version of MySQL you want). You can start mysqld by whatever means you want to. On Linux it's apparently common to use the mysql.server script to do so. The instructions you refer to above have you making an alias to this script and starting and stopping the server by manually running that script. On OS X launchd plists are the norm, which is what the mysql51-server and mysql55-server and mariadb-server and percona-server and mysql5-server ports set up for you.

You access a MySQL server with a MySQL client. Your MySQL client need not be on the same machine as your MySQL server. MySQL ships with libraries (in the mysql51/mysql55/mariadb/percona/mysql5 ports) which are used to build a client. MySQL ships with a program ("mysql5", in the mysql51/mysql55/mariadb/percona/mysql5 ports) which uses those libraries to provide you with a command-line client to access to the server. Various programming languages also provide ways to use those libraries to become MySQL clients to talk to your database server. PHP for example provides the mysql, mysqli and pdo_mysql extensions (all three of which are bundled into the php53-mysql/php54-mysql/php55-mysql/php5-mysql ports, depending on what version of PHP you want). Just installing e.g. php54-mysql (and then restarting your web server or its copy of PHP, depending on how your server is configured) will load those new PHP extensions into PHP and let you talk to the server. (In fact PHP is special and doesn't need MySQL libraries in order to talk to a MySQL server; it uses something called mysqlnd to do it without separate libraries. As far as I know, all other languages do.)



More information about the macports-users mailing list