Install MySQL on FreeBSD Print

  • freebsd, mysql, install
  • 0

To install MySQL 5.7 on FreeBSD:

pkg bootstrap -f (this is needed to install mysql with pkg)
pkg install mysql57-server mysql57-client (install mysql 5.7)
service mysql-server enable (autostart on boot)

or

append this line in /etc/rc.conf
mysql_enable="YES"
service mysql-server start
cat /root/.mysql_secret (see root password for mysql)
mysql -u root -p (enter mysql)
mysql -u root -p -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'newpassword';" (change root password of mysql)

ONLY IF ERROR APPEARS!!!
Note that if /var/db/mysql exists and is not empty, mysql-server will fail to start the first time. Backup or remove this directory if you need to:

Backup
mv /var/db/mysql /var/db/mysql.old
or
Remove
rm -rf /var/db/mysql


Was this answer helpful?

« Back

Powered by WHMCompleteSolution