Install MySQL on FreeBSD via Ports Collection
- Login to the FreeBSD system as root, or su - root to get to super user environment.
- Enter the following commands at FreeBSD command line interface (CLI) (Wait till each command to finish processing before running the next command):
- cd /usr/ports/databases/mysql50-server
make install clean
mysql_install_db
chown -R mysql /var/db/mysql/
chgrp -R mysql /var/db/mysql/
/usr/local/bin/mysqld_safe -user=mysql &Note: If you encounter Command not found error, use command rehash to update OS path environment variables.
- The port installation will put a script file mysql-server.sh in /usr/local/etc/rc.d which will has capability to start MySQL server. To enable MySQL server to start automatically after every FreeBSD server reboot, enter the following command in CLI:echo ‘mysql_enable=”YES”‘ >> /etc/ rc.conf
- By default, MySQL default super user account - root - has no password (blank password). So it’s important to assign the administrator account password. To change the password to root user, enter the following command:mysqladmin -u root password newpassword
Replace newpassword with your own desired password.
- Optionally, copy either my-huge.cnf, my-large.cnf, my-medim.cnf, my-small.cnf or my-innodb-heavy-4G.cnf (depending on the usage and utilization of MySQL server) as my.cnf to /var/db/mysql which will enable you to tweak and change the configuration of server-specific MySQL server options by editing the file.
- MySQL 5.0 installation done.