sumarsono.com
Take it with a grain of salt


Freebsd Install Mysql Server

Posted on

Install mysql server:

root@freebsd:~ # pkg install mysql57-server
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 18 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
  ca_root_nss: 3.69_1
  curl: 7.79.1
  cyrus-sasl: 2.1.27_2
  groff: 1.22.4_4
  libedit: 3.1.20210216,1
  libevent: 2.1.12
  libiconv: 1.16
  liblz4: 1.9.3,1
  libnghttp2: 1.44.0
  libpaper: 1.1.24.4
  libssh2: 1.9.0_3,3
  mysql57-client: 5.7.36
  mysql57-server: 5.7.36
  openldap24-client: 2.4.59_2
  perl5: 5.32.1_1
  protobuf: 3.17.3,1
  psutils: 1.17_5
  uchardet: 0.0.7

Number of packages to be installed: 18

The process will require 319 MiB more space.
41 MiB to be downloaded.

Proceed with this action? [y/N]: y

Enable mysql server service:

root@freebsd:~ # sysrc mysql_enable="yes"
mysql_enable:  -> yes
root@freebsd:~ # service mysql status
mysql does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable
root@freebsd:~ # service mysql-server status
mysql is not running.
root@freebsd:~ # service mysql-server start
Starting mysql.
root@freebsd:~ # service mysql-server status

Get mysql initial root password:

mysql is running as pid 4280.
root@freebsd:~ # cat /root/.mysql_secret
# Password set for user 'root@localhost' at 2021-11-21 23:49:10
5oWB=ea:pJSh

Secure mysql server installation:

root@freebsd:~ # mysql_secure_installation
Securing the MySQL server deployment.

Connecting to MySQL server using password in '/root/.mysql_secret'

VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Using existing password for root.

Estimated strength of the password: 100

Change the password for root ? ((Press y|Y for Yes, any other key for No) : Y

New password:

Re-enter new password:

Estimated strength of the password: 50
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.


Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.

 - Removing privileges on test database...
Success.

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

root@freebsd:~ #