Home > bsd > Freebsd 12.1-RELEASE Mariadb installation

Freebsd 12.1-RELEASE Mariadb installation

root@freebitch12:/etc # pkg search mariadb

mariadb-connector-c-3.1.9      MariaDB database connector for C
mariadb-connector-odbc-3.1.7_1 MariaDB database connector for odbc
mariadb103-client-10.3.23      Multithreaded SQL database (client)
mariadb103-server-10.3.23      Multithreaded SQL database (server)
mariadb104-client-10.4.13_4    Multithreaded SQL database (client)
mariadb104-server-10.4.13_4    Multithreaded SQL database (server)
rubygem-azure_mgmt_mariadb-0.17.3 Microsoft Azure Microsoft Azure MariaDB Library for Ruby Client Library for Ruby

root@freebitch12:/etc # pkg install mariadb104-server mariadb104-client

Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 12 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	bash: 5.0.17
	boost-libs: 1.72.0_2
	galera26: 26.4.5
	icu: 67.1,1
	libedit: 3.1.20191231,1
	liblz4: 1.9.2_1,1
	mariadb104-client: 10.4.13_4
	mariadb104-server: 10.4.13_4
	rsync: 3.2.3
	unixODBC: 2.3.7
	xxhash: 0.7.4
	zstd: 1.4.5

Number of packages to be installed: 12

The process will require 483 MiB more space.
60 MiB to be downloaded.

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

root@freebitch12:/etc # vim /etc/rc.conf

mysql_enable="yes"
mysql_pidfile="/var/db/mysql/mysql.pid" 
mysql_optfile="/usr/local/etc/mysql/my.cnf" 

root@freebitch12:/etc # service mysql-server start

Installing MariaDB/MySQL system tables in '/var/db/mysql' ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo

See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/usr/local' ; /usr/local/bin/mysqld_safe --datadir='/var/db/mysql'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/local/mysql-test' ; perl mysql-test-run.pl

Please report any problems at http://mariadb.org/jira

The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
Get Involved
Starting mysql.

root@freebitch12:/etc # service mysql-server status

 mysql is not running.

root@freebitch12:/etc # tail /var/log/mysql/mysqld.err

2020-10-02 19:02:13 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-10-02 19:02:13 0 [Note] InnoDB: Waiting for purge to start
2020-10-02 19:02:13 0 [Note] InnoDB: 10.4.13 started; log sequence number 60972; transaction id 21
2020-10-02 19:02:13 0 [Note] InnoDB: Loading buffer pool(s) from /var/db/mysql/ib_buffer_pool
2020-10-02 19:02:13 0 [Note] InnoDB: Buffer pool(s) load completed at 201002 19:02:13
2020-10-02 19:02:13 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-10-02 19:02:13 0 [Note] Server socket created on IP: '127.0.0.1'.
2020-10-02 19:02:13 0 [ERROR] Can't start server : Bind on unix socket: Permission denied
2020-10-02 19:02:13 0 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysql/mysql.sock ?
2020-10-02 19:02:13 0 [ERROR] Aborting

root@freebitch12:/etc # ls -alh /var/run/mysql/

total 8
drwxr-xr-x  2 root  wheel   512B Oct  2 19:19 .
drwxr-xr-x  7 root   wheel   512B Oct  2 19:00 ..

root@freebitch12:/etc # chown mysql:mysql /var/run/mysql/
root@freebitch12:/etc # service mysql-server start

Starting mysql.

root@freebitch12:/etc # service mysql-server status

mysql is running as pid 91966.

root@freebitch12:~ # mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] n
 ... skipping.

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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? [Y/n] 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? [Y/n] y
 ... Success!

By default, MariaDB 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? [Y/n] 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? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Possible Problem

** if you receive below error when you try to run mysql_secure_installation script just restart your server and re-run mysql_secure_installation , you’ll be fine

root@freebitch12:/etc # mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
error: Config file /etc/mail/.my.cnf.92133 in invalid location, please move to or merge with /usr/local/etc/mail/.my.cnf.92133
Fatal error in defaults handling. Program aborted
Enter current password for root (enter for none): 
Aborting!

Cleaning up...
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment