Hello,
I am developing a cPAddon Script. However, I am having difficulties trying to find out how to get the MySQL database name in my script code.
The documentation on the cPanel's web-site (Configuration File Variables) states:
"
The following variables are used in the default config file:
...
$VAR1 = {
'mysql.$meta_info->{mysql}[0].sqldb' => 'database_name', #MySQL database name
...
'mysql_pass' => 'abcdefghijklm', #Password for MySQL database user
...
'mysql_user' => 'domainuser_dbuser', #MySQL Database user
"
So, in the code of my cPAddon Script (XCart.pm), I can get and print out the MySQL user and password as follows:
sub install {
my $cpo = shift;
print "MySQL user: $cpo->{'mysql_user'} <br />";
print "MySQL password: $cpo->{'mysql_pass'} <br />";
}
However, I am not sure what is the correct syntax to get the MySQL database name in my script?
my $my_var = $cpo->{'mysql'}????
Thank you in advance for your help,
Sergey
I am developing a cPAddon Script. However, I am having difficulties trying to find out how to get the MySQL database name in my script code.
The documentation on the cPanel's web-site (Configuration File Variables) states:
"
The following variables are used in the default config file:
...
$VAR1 = {
'mysql.$meta_info->{mysql}[0].sqldb' => 'database_name', #MySQL database name
...
'mysql_pass' => 'abcdefghijklm', #Password for MySQL database user
...
'mysql_user' => 'domainuser_dbuser', #MySQL Database user
"
So, in the code of my cPAddon Script (XCart.pm), I can get and print out the MySQL user and password as follows:
sub install {
my $cpo = shift;
print "MySQL user: $cpo->{'mysql_user'} <br />";
print "MySQL password: $cpo->{'mysql_pass'} <br />";
}
However, I am not sure what is the correct syntax to get the MySQL database name in my script?
my $my_var = $cpo->{'mysql'}????
Thank you in advance for your help,
Sergey