Sometimes it can not be avoided. MySQL needs to be installed for one reason or another. This post covers installing MySQL on FreeBSD.
Install using packages.
Alternatively, install using ports.
Enable MySQL in rc.conf.
/etc/rc.conf partial listing
Start MySQL from the command line. Note that the above rc.conf line will automatically start MySQL when the machine boots. Note that the default location for my.conf is /usr/local/etc/mysql/my.cnf.
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. See this blog post to track down other errors when starting mysql-server for the first time.
Reset the password.
Note that the initial password is stored in $HOME/.mysql_secret.
For example, if you use
mysql -u root -p the initial password is stored in
If upgrading from an earlier version, run mysql_upgrade. Note that the command below upgrades as the root user.
Uninstall with pkg.
Uninstall with portmaster.
- MySQL, Installing MySQL on FreeBSD
- MySQL, How to Reset the Root Password
- MySQL, MySQL/MariaDB: Run SQL Queries From A Shell Prompt / Command Line
- MySQL, Find Out MySQL Version
- FreeBSD, FreeBSD mysql-server failed precmd routine
- FreeBSD, Upgrade MySQL 5.1.70 to 5.6.12
- FreeBSD, Properly deinstall ports and dependencies