42 |
|
|
43 |
# This part commented out for now - not a good idea to offer this capability? |
# This part commented out for now - not a good idea to offer this capability? |
44 |
# print ("DNS name or IP of the mySQL host upon which to install lidata: "); |
# print ("DNS name or IP of the mySQL host upon which to install lidata: "); |
45 |
# my $mysql_host; |
# my $xx_host; |
46 |
# $mysql_host = <STDIN>; |
# $xx_host = <STDIN>; |
47 |
# chomp($mysql_host); |
# chomp($xx_host); |
48 |
|
|
49 |
print ("mySQL user name capable of adding/dropping databases: "); |
print ("mySQL user name capable of adding/dropping databases: "); |
50 |
my $mysql_user; |
my $xx_user; |
51 |
$mysql_user = <STDIN>; |
$xx_user = <STDIN>; |
52 |
chomp($mysql_user); |
chomp($xx_user); |
53 |
|
|
54 |
print ("mySQL password associated with the specified user: "); |
print ("mySQL password associated with the specified user: "); |
55 |
use Term::ReadKey; |
use Term::ReadKey; |
56 |
ReadMode('noecho'); |
ReadMode('noecho'); |
57 |
$mysql_pwd = ReadLine(0); |
$xx_pwd = ReadLine(0); |
58 |
chomp($mysql_pwd); |
chomp($xx_pwd); |
59 |
ReadMode('normal'); |
ReadMode('normal'); |
60 |
|
|
61 |
# confirm for delete, display settings |
# confirm for delete, display settings |
62 |
print ("\n\nYou entered:\n"); |
print ("\n\nYou entered:\n"); |
63 |
print ("mySQL server name: $mysql_host\n"); |
print ("mySQL server name: $xx_host\n"); |
64 |
print ("mySQL user name: $mysql_user\n"); |
print ("mySQL user name: $xx_user\n"); |
65 |
|
|
66 |
print ("Continue with install? WARNING: This will DROP any databases \n"); |
print ("Continue with install? WARNING: This will DROP any databases \n"); |
67 |
print ("named libdata, libstats, and session on the specified mySQL\n"); |
print ("named libdata, libstats, and session on the specified mySQL\n"); |
76 |
|
|
77 |
# dump existing libdata, libstats, session |
# dump existing libdata, libstats, session |
78 |
print ( "Dropping libdata, libstats, and session databases!\n" ); |
print ( "Dropping libdata, libstats, and session databases!\n" ); |
79 |
`cat drop.sql | mysql -u$mysql_user -p$mysql_pwd`; |
`cat drop.sql | mysql -u$xx_user -p$xx_pwd`; |
80 |
|
|
81 |
# create new databases |
# create new databases |
82 |
print ("Creating new libdata, libstats and libsessions databases.\n"); |
print ("Creating new libdata, libstats and libsessions databases.\n"); |
83 |
`cat create.sql | mysql -u$mysql_user -p$mysql_pwd`; |
`cat create.sql | mysql -u$xx_user -p$xx_pwd`; |
84 |
|
|
85 |
print ("Populating libdata tables & data.\n"); |
print ("Populating libdata tables & data.\n"); |
86 |
`cat libdata.sql | mysql -u$mysql_user -p$mysql_pwd libdata`; |
`cat libdata.sql | mysql -u$xx_user -p$xx_pwd libdata`; |
87 |
|
|
88 |
print ("Populating libstats tables.\n"); |
print ("Populating libstats tables.\n"); |
89 |
`cat libstats.sql | mysql -u$mysql_user -p$mysql_pwd libstats`; |
`cat libstats.sql | mysql -u$xx_user -p$xx_pwd libstats`; |
90 |
|
|
91 |
print ("Populating libsession tables.\n"); |
print ("Populating libsession tables.\n"); |
92 |
`cat libsession.sql | mysql -u$mysql_user -p$mysql_pwd libsession`; |
`cat libsession.sql | mysql -u$xx_user -p$xx_pwd libsession`; |
93 |
|
|
94 |
# refresh/reload grants tables |
# refresh/reload grants tables |
95 |
print("Reloading and refreshing the mySQL grants tables.\n"); |
print("Reloading and refreshing the mySQL grants tables.\n"); |
96 |
`mysqladmin -u$mysql_user -p$mysql_pwd refresh`; |
`mysqladmin -u$xx_user -p$xx_pwd refresh`; |
97 |
`mysqladmin -u$mysql_user -p$mysql_pwd reload`; |
`mysqladmin -u$xx_user -p$xx_pwd reload`; |
98 |
|
|
99 |
# The "done" message |
# The "done" message |
100 |
print ("\nInstallation steps finished. Script terminated.\n"); |
print ("\nInstallation steps finished. Script terminated.\n"); |