This tutorial shows you how to install MySQL Server on a FreeBSD system.
How to Install MySQL Server on FreeBSD
FreeBSD simplifies software management with its packaging system and ports collection. Packages and ports automate the install, uninstall, and configuration process of thousands of software packages.
Let’s take a look at how to install MySQL on FreeBSD with the package manager.
Install with Package Manager
1. Switch to the root user.
2. Update FreeBSD repository.
If it’s your first time running the pkg update command, you might be asked to install the package management tool.
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]:
Type y and hit ENTER to install the package management tool and update the repositories.
3. Now we can install MySQL with the following command.
pkg install mysql80-server mysql80-client
4. Enable MySQL so that it starts when FreeBSD boots.
service mysql-server enable
5. Start MySQL now.
service mysql-server start
You should now be able to login as the root user with the MySQL client by running the following command.
mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 42
Server version: 8.0.26 Source distribution
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
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.