30 |
use Carp; |
use Carp; |
31 |
|
|
32 |
sub new { |
sub new { |
33 |
my($class,$dbms,$dbname,$dbuser,$dbpass,$dbport, $dbhost) = @_; |
my($class,$dbms,$dbname,$dbuser,$dbpass,$dbport, $dbhost, $dbsock) = @_; |
34 |
|
|
35 |
$dbms = defined($dbms) ? $dbms : $FIG_Config::dbms; |
$dbms = defined($dbms) ? $dbms : $FIG_Config::dbms; |
36 |
$dbname = defined($dbname) ? $dbname : $FIG_Config::db; |
$dbname = defined($dbname) ? $dbname : $FIG_Config::db; |
38 |
$dbpass = defined($dbpass) ? $dbpass : $FIG_Config::dbpass; |
$dbpass = defined($dbpass) ? $dbpass : $FIG_Config::dbpass; |
39 |
$dbport = defined($dbport) ? $dbport : $FIG_Config::dbport; |
$dbport = defined($dbport) ? $dbport : $FIG_Config::dbport; |
40 |
$dbhost = defined($dbhost) ? $dbhost : $FIG_Config::dbhost; |
$dbhost = defined($dbhost) ? $dbhost : $FIG_Config::dbhost; |
41 |
|
$dbsock = defined($dbsock) ? $dbsock : $FIG_Config::dbsock; |
42 |
|
|
43 |
return DBKernel::new($class, $dbms, $dbname, $dbuser, $dbpass, $dbport, $dbhost); |
return DBKernel::new($class, $dbms, $dbname, $dbuser, $dbpass, $dbport, $dbhost, $dbsock); |
44 |
} |
} |
45 |
|
|
46 |
=head1 get_inserted_id |
=head1 get_inserted_id |
125 |
$exe = "mysql_install_db"; |
$exe = "mysql_install_db"; |
126 |
} |
} |
127 |
|
|
128 |
my $rc = system($exe, |
|
129 |
"--datadir=$db_dir", |
my @opts; |
130 |
"--basedir=$FIG_Config::common_runtime", |
|
131 |
"--user=$FIG_Config::dbuser"); |
push(@opts, "--datadir=$db_dir"); |
132 |
|
push(@opts, "--user=$FIG_Config::dbuser"); |
133 |
|
|
134 |
|
if (not $FIG_Config::use_system_mysql) |
135 |
|
{ |
136 |
|
push(@opts, "--basedir=$FIG_Config::common_runtime") |
137 |
|
} |
138 |
|
|
139 |
|
|
140 |
|
my $rc = system($exe, @opts); |
141 |
if ($rc != 0) |
if ($rc != 0) |
142 |
{ |
{ |
143 |
my $err = $?; |
my $err = $?; |
192 |
|
|
193 |
my(@opts); |
my(@opts); |
194 |
|
|
195 |
|
my $cnf = "$FIG_Config::fig_disk/config/my.cnf"; |
196 |
|
|
197 |
|
if ($FIG_Config::use_system_mysql) |
198 |
|
{ |
199 |
|
# |
200 |
|
# This has to be first in the argument list. |
201 |
|
# |
202 |
|
push(@opts, "--defaults-extra-file=$cnf"); |
203 |
|
} |
204 |
|
|
205 |
push(@opts, "--port=$FIG_Config::dbport"); |
push(@opts, "--port=$FIG_Config::dbport"); |
206 |
# |
# |
207 |
# Don't do this; dbuser isn't the unix uid that we are using. |
# Don't do this; dbuser isn't the unix uid that we are using. |
208 |
# |
# |
209 |
#push(@opts, "--user=$FIG_Config::dbuser"); |
#push(@opts, "--user=$FIG_Config::dbuser"); |
210 |
push(@opts, "--basedir=$FIG_Config::common_runtime"); |
|
211 |
push(@opts, "--datadir=$FIG_Config::db_datadir"); |
push(@opts, "--datadir=$FIG_Config::db_datadir"); |
212 |
|
|
213 |
|
if ($FIG_Config::use_system_mysql) |
214 |
|
{ |
215 |
|
push(@opts, "--err-log=$FIG_Config::temp/mysql.log"); |
216 |
|
push(@opts, "--socket=$FIG_Config::dbsock"); |
217 |
|
|
218 |
|
# |
219 |
|
# Feh. You can't actually override the socket that /etc/my.cnf |
220 |
|
# sets up, so we need to set up a config/my.cnf with the socket in it. |
221 |
|
# |
222 |
|
|
223 |
|
if (! -f $cnf) |
224 |
|
{ |
225 |
|
if (open(F, ">$cnf")) |
226 |
|
{ |
227 |
|
print F <<END; |
228 |
|
[mysqld] |
229 |
|
socket=$FIG_Config::dbsock |
230 |
|
END |
231 |
|
close(F); |
232 |
|
} |
233 |
|
} |
234 |
|
} |
235 |
|
else |
236 |
|
{ |
237 |
|
push(@opts, "--basedir=$FIG_Config::common_runtime"); |
238 |
push(@opts, "--ledir=$FIG_Config::common_runtime/libexec"); |
push(@opts, "--ledir=$FIG_Config::common_runtime/libexec"); |
239 |
|
} |
240 |
|
|
241 |
|
if (not $FIG_Config::mysql_v3) |
242 |
|
{ |
243 |
push(@opts, "--old-password"); |
push(@opts, "--old-password"); |
244 |
push(@opts, "--max-allowed-packet=128M"); |
push(@opts, "--max-allowed-packet=128M"); |
245 |
|
} |
246 |
|
|
247 |
# |
# |
248 |
# Use InnoDB for large-table support and allegedly better performance. |
# Use InnoDB for large-table support and allegedly better performance. |
249 |
# |
# |
265 |
# try to use a system one. |
# try to use a system one. |
266 |
# |
# |
267 |
|
|
268 |
my $exe = "$FIG_Config::ext_bin/mysqld_safe"; |
my $exe; |
269 |
|
if ($FIG_Config::mysql_v3) |
270 |
print "Start $exe @opts\n"; |
{ |
271 |
if (! -x $exe) |
$exe = "safe_mysqld"; |
272 |
|
} |
273 |
|
else |
274 |
{ |
{ |
275 |
$exe = "mysqld_safe"; |
$exe = "mysqld_safe"; |
276 |
} |
} |
277 |
|
|
278 |
|
if (-x "$FIG_Config::ext_bin/$exe") |
279 |
|
{ |
280 |
|
$exe = "$FIG_Config::ext_bin/$exe"; |
281 |
|
} |
282 |
|
|
283 |
|
print "Start $exe @opts\n"; |
284 |
|
|
285 |
if ($dont_fork) |
if ($dont_fork) |
286 |
{ |
{ |
287 |
$ENV{MYSQL_TCP_PORT} = $FIG_Config::dbport; |
$ENV{MYSQL_TCP_PORT} = $FIG_Config::dbport; |