mysql-server-5.1.22 system administration docsonFreeBSD7.0-RELEASE-i386 ?

David Christensen dpchrist at
Sat Aug 30 04:18:41 UTC 2008

Reordered for clarity -- David.

I used pkg_add (rather than sysinstall) to install MySQL 5.1 server on another
machine.  While the port is called 'mysql-server-5.1.22', the package is called

    # cd /usr/ports/

    # make search mysql
    Port:   mysql-server-5.1.22
    Path:   /usr/ports/databases/mysql51-server
    Info:   Multithreaded SQL database (server)
    Maint:  ale at
    B-deps: gettext-0.16.1_3 gmake-3.81_2 libiconv-1.11_1 libtool-1.5.24
    R-deps: mysql-client-5.1.22

    # pkg_add -rK mysql51-server
    Added group "mysql".
    Added user "mysql".

Note the messages regarding the added group and user.

joeb wrote:
> To autostart mysql at boot add this to /etc/rc.conf
> mysql_enable="YES"
> Add this to /etc/rc.conf to direct to use this location where there
> is disk space to hold your databases
> mysql_dbdir="/usr/local/mysql"

mysql_enable and mysql_dbvar are briefly documented in

    # Add the following line to /etc/rc.conf to enable mysql:
    # mysql_enable (bool):  Set to "NO" by default.
    #                       Set it to "YES" to enable MySQL.
    # mysql_limits (bool):  Set to "NO" by default.
    #                       Set it to yes to run `limits -e -U mysql`
    #                       just before mysql starts.
    # mysql_dbdir (str):    Default to "/var/db/mysql"
    #                       Base database directory.
    # mysql_args (str):     Custom additional arguments to be passed
    #                       to mysqld_safe (default empty).

> You have to tell mysql to create its internal control db
> by running this command one time first before trying to create databases.
> mysql_install_db --user=mysql

The usage message for /usr/local/bin/mysql_install_db states:

  --user=user_name     The login username to use for running mysqld.  Files
                       and directories created by mysqld will be owned by this
                       user.  You must be root to use this option.  By default
                       mysqld runs using your current login name and files and
                       directories that it creates will be owned by you.

Your pointer likely saved me from running mysql_install_db as root and then
wondering why the server blows up when started (trying to read/write files owned
by root).

> The online mysql manual is at

The MySQL 5.1 Reference Manual (English) is here:

> To start or stop mysql server do this
> /usr/local/share/mysql/mysql.server start
> /usr/local/share/mysql/mysql.server stop
> To verify mysql is operational issue these commands
> mysqladmin version
> mysqladmin variables
> To start command line session with mysql server to
> create a DB enter
> mysql -u root
> The mysql databases and log files are written here
> /var/db/mysql




More information about the freebsd-questions mailing list