mysql56-server-5.6.36 how to determine datadir

Hello.
How to specify a separate disk for the database in mysql56-server-5.6.36 ?
in /etc/make.conf
Code:
PORTSDIR?=/usr/ports
.if ${.CURDIR} == ${PORTSDIR}/databases/mysql56-server
MY_DBDIR=/var/db/base_mysql/mysql
MY_SECDIR=/var/db/base_mysql/mysql_secure
MY_TMPDIR=/var/db/base_mysql/mysql_tmpdir
.endif
Code:
# cat /usr/local/etc/mysql/my.cnf
[client]
port=3306
socket=/tmp/mysql.sock
default-character-set = utf8
#
[mysqld]
datadir=/var/db/base_mysql/mysql
tmpdir=/tmp
bind-address=3.5.4.3
port=3306
socket=/tmp/mysql.sock
skip-external-locking
default-storage-engine = innodb
max_connections = 42
key_buffer_size = 70M
max_allowed_packet = 180M
table_open_cache = 3770
sort_buffer_size = 10M
read_buffer_size = 10M
join_buffer_size = 10M
read_rnd_buffer_size = 12M
max_heap_table_size=82M
tmp_table_size=82M
table_definition_cache = 3770
myisam_sort_buffer_size = 80M
query_cache_size= 850M
query_cache_type = 1
query_cache_limit= 105M
query_cache_min_res_unit= 1
thread_cache_size = 55
thread_concurrency = 16
#max_join_size = 80000000
#max_sort_length=624
innodb_buffer_pool_size = 27G
innodb_buffer_pool_instances = 6
innodb_additional_mem_pool_size = 25M
innodb_write_io_threads = 32
innodb_read_io_threads = 32
innodb_thread_concurrency = 32
innodb_flush_log_at_trx_commit = 0
innodb_flush_method = O_DIRECT
#skip-networking
#long_query_time=1
#slow_query_log=1
#slow_query_log_file="/var/log/mysql/slow-query.log"
log_error = /var/log/mysql/errors.log
#
[mysqldump]
quick
#
[mysql]
no-auto-rehash
#
[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
#
[mysqlhotcopy]
interactive-timeout
Code:
# ps -ax | grep mysql
25566  -  Ss       0:00.02 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/usr/local/etc/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --pid-file=/var/db/mysql/BA
26510  -  S        0:02.23 /usr/local/libexec/mysqld --defaults-extra-file=/usr/local/etc/mysql/my.cnf --basedir=/usr/local --datadir=/var/db/mysql --plugin-dir=/usr/local/lib/mysql/pl
26514  1  S+       0:00.00 grep mysql
How do I set the mysql to use a separate disk for the database?
As you can see --datadir= default.
Please tell me how to be, tried everything does not work as to specify --datadir= .
Code:
# uname -rms
FreeBSD 11.0-RELEASE-p10 amd64
Code:
# mysql -V
mysql  Ver 14.14 Distrib 5.6.36, for FreeBSD11.0 (amd64) using  EditLine wrapper
 
Code:
 ls -al /var/db/base_mysql/
total 12
drwxr-xr-x   3 root  wheel     512 Jul 13 20:39 .
drwxr-xr-x  16 root  wheel     512 Jul 13 20:58 ..
drwxrwxr-x   2 root  operator  512 Jul 10 15:28 .snap
Code:
# mount | grep base
/dev/nvd1p2 on /var/db/base_mysql (ufs, local, noatime)
 
Set mysql_dbdir in /etc/rc.conf:
Code:
mysql_dbdir="/var/db/base_mysql"

Just have a look in /usr/local/etc/rc.d/mysql-server.
 
Set mysql_dbdir in /etc/rc.conf:
Code:
mysql_dbdir="/var/db/base_mysql"

Just have a look in /usr/local/etc/rc.d/mysql-server.
The default is here --datadir=/var/db/mysql
It is possible to change whatever the default was put here --datadir=/var/db/base_mysql ?
 
Or that the default cannot be changed and need to be installed manually datadir (/usr/local/bin/mysql_install_db --datadir=/var/db/base_mysql --user=mysql)?
 
Just set mysql_dbdir in rc.conf. You really don't need to change anything else or rebuild things.
 
The server I have a new, empty.
I need to Wake after adding entry in rc mysql_dbdir.conf move/copy the contents of /var/db/mysql /var/db/base_mysql?
Or is it automatically created?
 
The first time you start MySQL the rc(8) script will check if the default databases are there. If they're not there they'll get automatically created.
 
Back
Top