MySQL Quick Installation on FreeBSD

Quick installation of MySQL Database on FreeBSD Server. Make sure you are on the latest FreeBSD Port Tree with portsnap, refer to keeping update ports. If you want to browse through what version of MySQL is available in FreeBSD;


shell> cd /usr/ports
shell> make search name=mysql | less
shell> Port:   mysql-server-5.1.34
Path:   /usr/ports/databases/mysql51-server
Info:   Multithreaded SQL database (server)
Maint:  ale@FreeBSD.org
B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26 mysql-client-5.1.34
R-deps: mysql-client-5.1.34
WWW:    http://www.mysql.com/

Port:   mysql-client-6.0.10
Path:   /usr/ports/databases/mysql60-client
Info:   Multithreaded SQL database (client)
Maint:  ale@FreeBSD.org
B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26
R-deps:
WWW:    http://www.mysql.com/

Port:   mysql-scripts-6.0.10
Path:   /usr/ports/databases/mysql60-scripts
Info:   Multithreaded SQL database (scripts)
Maint:  ale@FreeBSD.org
B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26 mysql-client-6.0.10 perl-5.8.9_2
R-deps: mysql-client-6.0.10 p5-DBD-mysql60-4.010 p5-DBI-1.60.7 p5-Storable-2.18 perl-5.8.9_2
WWW:    http://www.mysql.com/

Port:   mysql-server-6.0.10
Path:   /usr/ports/databases/mysql60-server
Info:   Multithreaded SQL database (server)
Maint:  ale@FreeBSD.org
B-deps: gettext-0.17_1 gmake-3.81_3 libiconv-1.11_1 libtool-1.5.26 mysql-client-6.0.10
R-deps: mysql-client-6.0.10
WWW:    http://www.mysql.com/

MySQL Installation with FreeBSD Port

We will take MySQL5.0 as example, to install


shell> cd /usr/ports/databases/mysql50-server/
shell> make install clean distclean

It will take 5-15 minutes for installation and compile time. If you have any error during compiling MySQL, please do not hesitate to post in the comment box here.

You don’t have to run mysql_install_db, to before starting MySQL, put this lines in /etc/rc.conf file;


mysql_enable="YES"
mysql_dbdir="/opt/database/mysql" # define your own DB Dir.

To start MySQL


shell> /usr/local/etc/rc.d/mysql-server start
090605  8:56:26 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
090605  8:56:26 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
090605  8:56:27 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
090605  8:56:27 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295

You will see the warning messages for the first time of launching MySQL Server, just another warning message.

Customize MySQL’s my.cnf File and Post Install

MySQL’s default my.cnf file is available at /usr/local/share/mysql, copy the cnf file which suit your usage to the database data directory you have defined earlier on /etc/rc.conf. Stop and start MySQL if you make any changes on my.cnf file.

By default, MySQL doesn’t set password for system root account, it’s advice to set a password for your MySQL’s root account;


shell> mysqladmin -u root password 

Now, you can access to your MySQL database


shell> mysql -u root -p (enter your password when prompt)
shell> Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 9
Server version: 5.0.77 FreeBSD port: mysql-server-5.0.77_1

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

If you do not want to use root, you can create an account by your own username;


mysql> CREATE USER 'huhu'@'localhost' IDENTIFIED BY 'your_password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'huhu'@'localhost' WITH GRANT OPTION;

That’s the quick install of MySQL5 on FreeBSD Server, it’s quick isn’t it?

Related posts:

  1. Reset MySQL Root Password Very often, once we didn’t log on to MySQL database...
  2. Create Root Privilege User on MySQL By default, MySQL root privileges user is “root”, I always...
  3. Change or Set User Password in FreeBSD If you notice, during FreeBSD installation, it doesn’t have a...
  4. Install MySQL5 Server on Apple Mac Leopard with MacPorts Previously I wrote a post on “installing postgresql 8.2 on...
  5. FreeBSD Port: Error Upgrading Perl 5.8.9 Usually I perform portupgrade daily on some of my FreeBSD...
  6. How to Remove MySQL Binary Log By default, MySQL 5.0 and above enables MySQL Binary Log....
  7. Cacti Spine Source Installation Error on FreeBSD Just noticed FreeBSD’s port still using old version of spine,...
  8. MySQL 5 Server Cannot Start on Apple Mac Leopard There were some problem during configuring MySQL5 Server on Leopard...
  9. How To Fix php5-pcre Ignored Package in FreeBSD Ports I guess most of the FreeBSD users having problem to...
  10. OURMON Installation and Configuration on FreeBSD 7 with Multi-threading Support OURMON is popular known as open source Network Monitoring and...

One Response to “MySQL Quick Installation on FreeBSD”

  1. iPhone Apps Blog Says:

    Thanks for the tips, I just got my MySQL server running in BSD8.0

Leave a Reply