Support #379
Install MariaDB Database Server On FreeBSD
Description
Install MariaDB¶
Install MariaDB from pkg¶
Install MariaDB:
pkg install mariadb55-{server,client}
Build MariaDB from Source¶
- Install MariaDB, this will also build the MariaDB client:
cd /usr/ports/databases/mariadb55-server/ make config ; make install clean rehash
Configure MariaDB¶
- Edit
rc.conf
to start MariaDB at boot:vi /etc/rc.conf
- Add
mysql_enable
mysql_enable="YES"
- Manually start MariaDB:
service mysql-server start
Setup grant tables, make sure to have the MariaDB server running since mysql_install_db assumes its running from here:
cd /usr/local/ mysql_install_db --user=mysql
- Configure the MariaDB server root password:
mysql_secure_installation
- (Optional) Configure MariaDB server root password manually:
mysqladmin -u root password 'appleton' mysqladmin -u root -p -h firefly.scc.local password 'appleton'
- (Optional) Grant root permission to connect remotely:
mysql -u root -p mysql> grant all privileges on *.* to 'root'@'%' identified by 'appleton' with grant option; mysql> exit;
- (Optional) Configure MariaDB server root password manually:
Configure MariaDB Server¶
Use the provided my-medium.cnf
config file and edit for using InnoDB tables:
The output from “my_print_defaults –help” implies my-medium.cnf should copied to /etc/my.cnf, but I’ll use the MySQL convention I’ve learned until I know different.
cp /usr/local/share/mysql/my-medium.cnf /var/db/mysql/my.cnf vi /var/db/mysql/my.cnf
#! Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /var/db/mysql
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/db/mysql
#! You can set .._buffer_pool_size up to 50 - 80 %
#! of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
#! Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
- Restart MariaDB:
- service mysql-server restart
- And finally do a basic test to confirm things are basically working:
mysql -u root -p
MariaDB [(none)]> show databases;
MariaDB [(none)]> exit;
Bye