How To Install MySQL 5.7 On FreeBSD
cd /usr/ports/databases/mysql57-server && make install clean BATCH=yes
Note: Initial password for MySQL 5.7 is saved in /root/.mysql_secret ie. so when using “mysql -u root -p” for the first time use that password. Also worth noticing the fact that the default location for my.cnf has changed from “/var/db/mysql/my.cnf” to “/usr/local/etc/mysql/my.cnf”
cp /usr/local/etc/mysql/my.cnf.sample /usr/local/etc/mysql/my.cnf chown mysql:mysql /usr/local/etc/mysql/my.cnf
My personal my.cnf file has some additional entries that differ from the default.
[mysqld] ft_min_word_len=2 [myisamchk] ft_min_word_len=2 [mysqldump] ignore-table=mysql.event
Enable MySQL to startup after boot by adding the following to /etc/rc.conf and then either reboot or start MySQL manually.
mysql_enable="YES"
Note: MySQL now creates a random password that resides in /root/.mysql_secret. Now secure your installation issuing this command.
mysql_secure_installation
Advice: After running the above command please consider changing the mysql root passwd. this can be done like this. If the .mysql_secret password is “abc”, you can set the new password to “123456” by typing.
mysqladmin -u root -p'abc' password '123456'
Once done delete /root/.mysql_secret
rm /root/.mysql_secret
Check if things are working as intended.
ps -waux |grep "mysql"