How to install and start MySQL server 5.6 on FreeBSD 10.0

This page explains how to install and start the MySQL server version 5.6 on the FreeBSD 10.0 operating system.

To install the software, log in as root and type

# pkg install mysql56-server mysql56-client

This installs the database server and the client. To allow the database server to run, edit the file /etc/rc.conf to add the following line:


Now you can start the server with

# /usr/local/etc/rc.d/mysql-server start
You will see output similar to the following:
Starting mysql.

You can test that the database is running correctly using the command-line tool mysql. Type

The output looks like this:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.17 Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

You can leave the command line tool by typing "exit"

mysql> exit

The output looks like this:


To stop the server, use

# /usr/local/etc/rc.d/mysql-server stop

The output looks like this:

Stopping mysql.
Waiting for PIDS: 2110.

Again you can check the server is not running using the command line tool:

# mysql

The output looks like this:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

If the server is running, and you want to restart it, you can also do that as follows:

# /usr/local/etc/rc.d/mysql-server restart

The output looks like this:

Stopping mysql.
Waiting for PIDS: 1977.
Starting mysql.

Copyright © Ben Bullock 2009-2017. All rights reserved. For comments, questions, and corrections, please email Ben Bullock ( / Privacy / Disclaimer