Installing MySQL into FreeBSD

Home / Installing MySQL into FreeBSD

Installing MySQL into FreeBSD

December 5, 2015 | Article | 1 Comment

On different article, we have discussed about how to configure MySQL on Slackware. In this article we will discuss about how to install MySQL server on FreeBSD machine.

If you want to building a Web Server (installing Apache and PHP) then you might want to install MySQL Database first.

MySQL is well-known as reliable, free open source Database Management. Most of web server use MySQL as Database backend.

For this, I use FreeBSD 8.3 amd64, but you can have any FreeBSD version and platform as you please. The MySQL we use would be 5.5 as provided on FreeBSD ports collection.

Installing the port

Installing MySQL is as easy as installing any ports. Do the following commands:

cd /usr/ports/databases/mysql55-server
make install

If you are going to do fresh installation, you will be prompted by installation options menu. The configuration I choose are list here:

  1. OPENSSL (Enable SSL support)

You might also want to install the client:

cd /usr/ports/databases/mysql55-server
make install

The configuration I choose are list here:

  1. OPENSSL (Enable SSL support)

Once you finish installing, you might find a mysqld script on /usr/local/etc/rc.d. MySQL then will store the data in /var/db/mysql

Starting MySQL

/etc/rc.conf must contain the following line to allow the MySQL server to start

mysql_enable="YES"

Once this line is there you can run the start up script with

/usr/local/etc/rc.d/mysql-server.sh start

Setting the root password

Normally, MySQL root account and anonymouse has no password on fresh install. Therefore we need to set password on it. If not, MySQL will give full access to the database server to anyone.

To set a password on the root accounts use

mysql -u root
mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');

Note that mysql> is prompt you got when you enter MySQL console.
To set a password for the root account use

mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');

Managing your MySQL server with phpMyAdmin

If you are to lazy to use terminal and want to administrate Database graphically, you can use phpMyAdmin. To do that, you have to install Apache and PHP first. With this tool, you can manage MySQL database with web interface. It allows you to perform SQL queries, create new databases, add users, change privileges, backup and import data.

To install phpMyAdmin, you can invoke following commands:

cd /usr/ports/databases/phpmyadmin
make install

,

About Author

about author

xathrya

A man who is obsessed to low level technology.

1 Comment
  1. Install and Configure Apache Web Server and PHP5 in FreeBSD - Xathrya.ID

    […] might also install MySQL […]

Leave a Reply

Your email address will not be published. Required fields are marked *

Social media & sharing icons powered by UltimatelySocial