How to install MySQL 5.1 on FreeBSD 7.2
I've had trouble in the past with installing MySQL on FreeBSD. This is the best method I've used that works.
Before we start, make sure your ports are updated.
portsnap fetch
portsnap update
Right. Now we're ready.
cd /usr/ports/databases/mysql51-server
make install clean
This might take a while. Do something productive.
When that finishes we'll install the database, and make sure user and group mysql is the owner of the database folder.
/usr/local/bin/mysql_install_db
chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/
Next, we'll set MySQL to start at FreeBSD boot.
echo 'mysql_enable="YES"' >> /etc/rc.conf
Finally, we'll start MySQL and change the root password to keep out the hackers.
/usr/local/etc/rc.d/mysql-server start
/usr/local/bin/mysqladmin -u root password newpassword
Full code:
cd /usr/ports/databases/mysql51-server
make install clean
/usr/local/bin/mysql_install_db
chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/
echo 'mysql_enable="YES"' >> /etc/rc.conf
/usr/local/etc/rc.d/mysql-server start
/usr/local/bin/mysqladmin -u root password newpassword

September 28th, 2009 - 12:01
Good TuTorial! *THX*