Lines 9-17
Link Here
|
9 |
# Add the following line to /etc/rc.conf to enable mysql: |
9 |
# Add the following line to /etc/rc.conf to enable mysql: |
10 |
# mysql_(instance_)?enable (bool): Set to "NO" by default. |
10 |
# mysql_(instance_)?enable (bool): Set to "NO" by default. |
11 |
# Set it to "YES" to enable MySQL. |
11 |
# Set it to "YES" to enable MySQL. |
12 |
# mysql_(instance_)?limits (bool): Set to "NO" by default. |
12 |
%%LEGACY_LIMITS%%# mysql_(instance_)?limits (bool): Set to "NO" by default. |
13 |
# Set it to yes to run `limits -e -U mysql` |
13 |
%%LEGACY_LIMITS%%# Set it to yes to run `limits -e -U mysql` |
14 |
# just before mysql starts. |
14 |
%%LEGACY_LIMITS%%# just before mysql starts. |
15 |
# mysql_(instance_)?dbdir (str): Default to "/var/db/mysql" |
15 |
# mysql_(instance_)?dbdir (str): Default to "/var/db/mysql" |
16 |
# Base database directory. |
16 |
# Base database directory. |
17 |
# mysql_(instance_)?args (str): Custom additional arguments to be passed |
17 |
# mysql_(instance_)?args (str): Custom additional arguments to be passed |
Lines 22-28
Link Here
|
22 |
# Default to "mysql" created by the port |
22 |
# Default to "mysql" created by the port |
23 |
# mysql_(instance_)?optfile (str): Server-specific option file. |
23 |
# mysql_(instance_)?optfile (str): Server-specific option file. |
24 |
# Default to "${mysql_dbdir}/my.cnf". |
24 |
# Default to "${mysql_dbdir}/my.cnf". |
25 |
# mysql_instances (str): Set to "" by default. |
25 |
# mysql_instances (str): Set to "" by default. |
26 |
# If defined, list of instances to enable |
26 |
# If defined, list of instances to enable |
27 |
|
27 |
|
28 |
. /etc/rc.subr |
28 |
. /etc/rc.subr |
Lines 33-41
rcvar=mysql_enable
Link Here
|
33 |
load_rc_config $name |
33 |
load_rc_config $name |
34 |
|
34 |
|
35 |
: ${mysql_enable="NO"} |
35 |
: ${mysql_enable="NO"} |
36 |
: ${mysql_limits="NO"} |
36 |
%%LEGACY_LIMITS%%: ${mysql_limits="NO"} |
37 |
: ${mysql_user="mysql"} |
37 |
: ${mysql_user="mysql"} |
38 |
: ${mysql_limits_args="-e -U $mysql_user"} |
38 |
%%LEGACY_LIMITS%%: ${mysql_limits_args="-e -U $mysql_user"} |
39 |
: ${mysql_dbdir="/var/db/mysql"} |
39 |
: ${mysql_dbdir="/var/db/mysql"} |
40 |
: ${mysql_optfile="${mysql_dbdir}/my.cnf"} |
40 |
: ${mysql_optfile="${mysql_dbdir}/my.cnf"} |
41 |
|
41 |
|
Lines 51-59
if [ -n "$2" ]; then
Link Here
|
51 |
"$2 "*|*" $2 "*|*" $2"|"$2") |
51 |
"$2 "*|*" $2 "*|*" $2"|"$2") |
52 |
eval mysql_args="\${mysql_${instance}_args:-\"${mysql_args}\"}" |
52 |
eval mysql_args="\${mysql_${instance}_args:-\"${mysql_args}\"}" |
53 |
eval mysql_dbdir="\${mysql_${instance}_dbdir:-\"/var/db/mysql_${instance}\"}" |
53 |
eval mysql_dbdir="\${mysql_${instance}_dbdir:-\"/var/db/mysql_${instance}\"}" |
54 |
eval mysql_limits="\${mysql_${instance}_limits:-\"${mysql_limits}\"}" |
54 |
%%LEGACY_LIMITS%% eval mysql_limits="\${mysql_${instance}_limits:-\"${mysql_limits}\"}" |
55 |
eval mysql_user="\${mysql_${instance}_user:-\"${mysql_user}\"}" |
55 |
eval mysql_user="\${mysql_${instance}_user:-\"${mysql_user}\"}" |
56 |
eval mysql_limits_args="\${mysql_${instance}_limits_args:-\"-e -U $mysql_user\"}" |
56 |
%%LEGACY_LIMITS%% eval mysql_limits_args="\${mysql_${instance}_limits_args:-\"-e -U $mysql_user\"}" |
57 |
eval mysql_optfile="\${mysql_${instance}_optfile:-\"${mysql_dbdir}/my.cnf\"}" |
57 |
eval mysql_optfile="\${mysql_${instance}_optfile:-\"${mysql_dbdir}/my.cnf\"}" |
58 |
eval mysql_pidfile="\${mysql_${instance}_pidfile:-\"${mysql_dbdir}/`/bin/hostname`.pid\"}" |
58 |
eval mysql_pidfile="\${mysql_${instance}_pidfile:-\"${mysql_dbdir}/`/bin/hostname`.pid\"}" |
59 |
;; |
59 |
;; |
Lines 119-129
mysql_prestart()
Link Here
|
119 |
if [ ! -d "${mysql_dbdir}/mysql/." ]; then |
119 |
if [ ! -d "${mysql_dbdir}/mysql/." ]; then |
120 |
mysql_create_auth_tables || return 1 |
120 |
mysql_create_auth_tables || return 1 |
121 |
fi |
121 |
fi |
122 |
if checkyesno mysql_limits; then |
122 |
%%LEGACY_LIMITS%% if checkyesno mysql_limits; then |
123 |
eval `/usr/bin/limits ${mysql_limits_args:-"-e -U $mysql_user"}` 2>/dev/null |
123 |
%%LEGACY_LIMITS%% eval `/usr/bin/limits ${mysql_limits_args:-"-e -U $mysql_user"}` 2>/dev/null |
124 |
else |
124 |
%%LEGACY_LIMITS%% else |
125 |
return 0 |
125 |
%%LEGACY_LIMITS%% return 0 |
126 |
fi |
126 |
%%LEGACY_LIMITS%% fi |
|
|
127 |
%%MODERN_LIMITS%% return 0 |
127 |
} |
128 |
} |
128 |
|
129 |
|
129 |
mysql_poststart() |
130 |
mysql_poststart() |