FreeBSD MySQL - how to install ports version

floris

Verified User
Joined
Oct 23, 2005
Messages
94
I successfully installed the ports version of MySQL on a FreeBSD 6.1 box. I'd like to share with you how i've done it.

Note:
-------------------
Existing databases can often be preserved, but this depends on which version of mysql is installed. When you for example revert to 4.1 from 5.0, you will need to export all databases (hint: mysqldump), delete all databases and import.

The root database can ofcourse be created using "mysqladmin -uroot -p". DA stores the mysql root password in /usr/local/directadmin/scripts/setup.txt.

A good read: http://help.directadmin.com/item.php?id=45
-------------------

1) remove old database

killall mysqld
rm /usr/local/mysql
rm -r /usr/local/mysql-[old-version]

2) install port (5.1 is beta; better not use it)

cd /usr/ports/databases/mysql41-server && make install clean
or
cd /usr/ports/databases/mysql50-server && make install clean



3) Enable mysql and set correct home dir

vi /etc/rc.conf
mysql_enable="YES"
mysql_dbdir="/home/mysql"

4) make startup script da friendly

rm /usr/local/etc/rc.d/mysqld
mv /usr/local/etc/rc.d/mysql-server /usr/local/etc/rc.d/mysqld

5) modification for sysbackup

* not necessary if file is empty i think

vi /usr/local/sysbk/sysbk.conf
--> modify pid and path

6) start mysql

/usr/local/etc/rc.d/mysqld start

7) add directadmin user

mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO da_admin@localhost IDENTIFIED BY 'newdapass' WITH GRANT OPTION;
FLUSH PRIVILEGES;

quit

'newdapass' is the password that's stored under the adminpass key in /usr/local/directadmin/scripts/setup.txt.

8) Edit configure.php_ap2 to reflect new position of mysql. Otherwise a rebuild of php will fail.

cd /usr/local/directadmin/customapache
vi configure.php_ap2
--with-mysql=/usr/local

This worked perfectly for me.
 
Last edited:
Back
Top