{"id":3382,"date":"2019-06-21T22:05:23","date_gmt":"2019-06-21T19:05:23","guid":{"rendered":"https:\/\/kifarunix.com\/?p=3382"},"modified":"2019-06-21T22:05:25","modified_gmt":"2019-06-21T19:05:25","slug":"install-mysql-8-on-freebsd-12","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-mysql-8-on-freebsd-12\/","title":{"rendered":"Install MySQL 8 on FreeBSD 12"},"content":{"rendered":"\n
In this tutorial, we are going to learn how to install MySQL 8 on FreeBSD 12. MySQL 8 can be installed on FreeBSD 12 using Ports collection or using the MySQL generic Unix binaries. This guide focuses on using the FreeBSD 12 Ports collection.<\/p>\n\n\n\n
To compile an application\/port using Ports Collection, you should first install the Ports Collection if they were not installed with the OS. The Ports Collection is stored as a subdirectory of\u00a0 If the Ports Collection are not installed, see the section of installing Ports Collection in the link below.<\/p>\n\n\n\n Install or Uninstall Software on FreeBSD 12 using Ports Collection<\/a><\/p>\n\n\n\n Once you have installed Ports Collection, proceed to install MySQL 8.<\/p>\n\n\n\n Navigate to MySQL Ports subdirectory and run make install<\/strong> to install MySQL 8 server.<\/p>\n\n\n\n The clean<\/strong> option ensures that all the temporary files generated during compilation are removed from the system to save on disk space.<\/p>\n\n\n\n Note that compilation may take sometime depending on how powerful your system is.<\/p>\n\n\n\n At the end of compilation, if all goes well, you will see such an output.<\/p>\n\n\n\n Speaking of security, FreeBSD pkg\u00a0includes a built-in auditing mechanism for determining if there are any known vulnerabilities for the software installed on the system.<\/p>\n\n\n\n Next, run the command below to add MySQL service to \/etc\/rc.conf<\/strong>.<\/p>\n\n\n\n Next, start MySQL<\/p>\n\n\n\n Check the service status<\/p>\n\n\n\n To run initial MySQL security, run the mysql_secure_installation<\/strong> script.<\/p>\n\n\n\n When run, the script prompts you on whether to enforce password complexity through the use of validate_password_policy<\/em>. Type Y and press Enter to enable or any other key to ignore.<\/p>\n\n\n\n If you accept to enable the validate password plugin, you will be prompted to choose the level of complexity, with three levels provided. Choose the level and press ENTER to proceed.<\/p>\n\n\n\n Next, set the MySQL root user password.<\/p>\n\n\n\n Remove anonymous users, disallow remote root login, remove test databases and reload privileges tables to apply the changes.<\/p>\n\n\n\n MySQL 8 is now installed and running on FreeBSD 12. To verify the installation, you can login as root and check the database version.<\/p>\n\n\n\n Well done. You have successfully installed MySQL 8 on FreeBSD 12.<\/p>\n\n\n\n Related tutorial;<\/p>\n\n\n\n Install MySQL 8 on Debian 9<\/a><\/p>\n\n\n\n Install MySQL 8 on Fedora 30\/Fedora 29<\/a><\/p>\n\n\n\n Install LAMP Stack on Fedora 30<\/a><\/p>\n\n\n\n How To Install LAMP (Linux, Apache, MySQL, PHP) Stack on Fedora 28\/29<\/a><\/p>\n\n\n\n Install MariaDB 10.3 on CentOS 7<\/a><\/p>\n\n\n\n\/usr\/ports<\/code> by default. The specific Ports collection for MySQL database server and client should then be located under, \/usr\/ports\/databases\/mysql80-server<\/strong> and \/usr\/ports\/databases\/mysql80-client<\/strong> respectively.<\/p>\n\n\n\n
ls \/usr\/ports\/databases\/mysql80-{server,client}\n\/usr\/ports\/databases\/mysql80-client:\nMakefile\tfiles\t\tpkg-message\tpkg-plist\n\n\/usr\/ports\/databases\/mysql80-server:\nMakefile\tdistinfo\tfiles\t\tpkg-descr\tpkg-message\tpkg-plist<\/code><\/pre>\n\n\n\n
Install MySQL 8 server on FreeBSD 12<\/h4>\n\n\n\n
cd \/usr\/ports\/databases\/mysql80-server\nmake install clean<\/code><\/pre>\n\n\n\n
...\n*****************************************************************************\n\n===> SECURITY REPORT: \n This port has installed the following files which may act as network\n servers and may therefore pose a remote security risk to the system.\n\/usr\/local\/lib\/mysql\/mysqlrouter\/routing.so\n\/usr\/local\/lib\/mysql\/plugin\/group_replication.so\n\/usr\/local\/libexec\/mysqld\n\n This port has installed the following startup scripts which may cause\n these network services to be started at boot time.\n\/usr\/local\/etc\/rc.d\/mysql-server\n\n If there are vulnerabilities in these programs there may be a security\n risk to the system. FreeBSD makes no guarantee about the security of\n ports included in the Ports Collection. Please type 'make deinstall'\n to deinstall the port if this is a concern.\n\n For more information, and contact details about the security\n status of this software, see the following webpage: \nhttps:\/\/www.mysql.com\/<\/code><\/pre>\n\n\n\n
pkg audit -F\nFetching vuln.xml.bz2: 100% 793 KiB 405.9kB\/s 00:02 \n0 problem(s) in the installed packages found.<\/code><\/pre>\n\n\n\n
Running MySQL<\/h3>\n\n\n\n
sysrc mysql_enable=yes<\/code><\/pre>\n\n\n\n
service mysql-server start<\/code><\/pre>\n\n\n\n
service mysql-server status\nmysql is running as pid 63804.<\/code><\/pre>\n\n\n\n
Securing MySQL<\/h3>\n\n\n\n
mysql_secure_installation<\/code><\/pre>\n\n\n\n
VALIDATE PASSWORD COMPONENT can be used to test passwords\nand improve security. It checks the strength of password\nand allows the users to set only those passwords which are\nsecure enough. Would you like to setup VALIDATE PASSWORD component?\n\nPress y|Y for Yes, any other key for No: Y<\/code><\/pre>\n\n\n\n
There are three levels of password validation policy:\n\nLOW Length >= 8\nMEDIUM Length >= 8, numeric, mixed case, and special characters\nSTRONG Length >= 8, numeric, mixed case, special characters and dictionary file\n\nPlease enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1<\/code><\/pre>\n\n\n\n
Please set the password for root here.\n\nNew password: Str0ng@123P@SS\n\nRe-enter new password: Str0ng@123P@SS<\/code><\/pre>\n\n\n\n
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\n\nNormally, root should only be allowed to connect from\n'localhost'. This ensures that someone cannot guess at\nthe root password from the network.\n\nDisallow root login remotely? (Press y|Y for Yes, any other key for No) : y \nSuccess.\n\nBy default, MySQL comes with a database named 'test' that\nanyone can access. This is also intended only for testing,\nand should be removed before moving into a production\nenvironment.\n\n\nRemove test database and access to it? (Press y|Y for Yes, any other key for No) : y\n - Dropping test database...\nSuccess.\n\n - Removing privileges on test database...\nSuccess.\n\nReloading the privilege tables will ensure that all changes\nmade so far will take effect immediately.\n\nReload privilege tables now? (Press y|Y for Yes, any other key for No) : y\nSuccess.\n\nAll done!<\/code><\/pre>\n\n\n\n
mysqladmin -u root -p version\nEnter password: \nmysqladmin Ver 8.0.16 for FreeBSD12.0 on amd64 (Source distribution)\nCopyright (c) 2000, 2019, Oracle and\/or its affiliates. All rights reserved.\n\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nServer version\t\t8.0.16\nProtocol version\t10\nConnection\t\tLocalhost via UNIX socket\nUNIX socket\t\t\/tmp\/mysql.sock\nUptime:\t\t\t28 min 39 sec\n\nThreads: 2 Questions: 15 Slow queries: 1 Opens: 162 Flush tables: 3 Open tables: 63 Queries per second avg: 0.008<\/code><\/pre>\n\n\n\n