Installation:FreeBSD:MySQL

From PMWH2 - PHPMyWebHosting's official wiki
Revision as of 16:49, 13 February 2006 by Chris (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Installation

When you install MySQL on FreeBSD, you actually have five options:

Since the 5.0 branch is very unstable and development, it (probably) won't suit your needs just now.

So decide for yourself if you want 4.0 branch or 4.1 branch of the MySQL server. Main differences right now are probably stability and a save feeling for (4.0) and new features (4.1).

In only few cases I compile the MySQL server from source. This is not recommend anywhere, but it sometimes helps to gain some performance. However, for most the ports are just as good, and as of right now I would recommend using MySQL-server 4.0.

Required port (replace x with 0 or 1):

mysql4x-server

To install:

cd /usr/ports/databases/mysql4x-server
make
make install
make clean

This will install the server and the client. For additional configuration options (for example: alternative DB directory and so on), please consult the Makefile in the port's directory.

To start the server when the system boots, add the following line to your /etc/rc.conf:

mysql_enable="YES"

Start the server with ./mysql-server.sh start in /usr/local/etc/rc.d. If you don't see a MySQL process in your process list, you can enable the start log to check whatever it's longing for.

Changing the root password

Once your server is running, do the following:

mysqladmin -u root password "newpwd"
Debugging

Copy the sample configuration file to modify:

 cp /usr/local/share/mysql/my-medium.conf /etc/my.cnf

To enable the start log, add the following line to your /etc/my.cnf (under [mysqld]):

log-error = /var/log/mysql-startup.log

Just in case, do the following before restarting:

touch /var/log/mysql-startup.log
chown mysql:mysql /var/log/mysql-startup.log

Restart the server with:

./mysql-server.sh restart

Any more questions? The world's best documentation, right at your finger tips!