37 |
|
|
38 |
# 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? |
39 |
# 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: "); |
40 |
# my $mysql_host; |
# my $xx_host; |
41 |
# $mysql_host = <STDIN>; |
# $xx_host = <STDIN>; |
42 |
# chomp($mysql_host); |
# chomp($xx_host); |
43 |
|
|
44 |
print ("mySQL user name capable of adding/dropping databases: "); |
print ("mySQL user name capable of adding/dropping databases: "); |
45 |
my $mysql_user; |
my $xx_user; |
46 |
$mysql_user = <STDIN>; |
$xx_user = <STDIN>; |
47 |
chomp($mysql_user); |
chomp($xx_user); |
48 |
|
|
49 |
print ("mySQL password associated with the specified user: "); |
print ("mySQL password associated with the specified user: "); |
50 |
use Term::ReadKey; |
use Term::ReadKey; |
51 |
ReadMode('noecho'); |
ReadMode('noecho'); |
52 |
$mysql_pwd = ReadLine(0); |
$xx_pwd = ReadLine(0); |
53 |
chomp($mysql_pwd); |
chomp($xx_pwd); |
54 |
ReadMode('normal'); |
ReadMode('normal'); |
55 |
|
|
56 |
# confirm for delete, display settings |
# confirm for delete, display settings |
57 |
print ("\n\nYou entered:\n"); |
print ("\n\nYou entered:\n"); |
58 |
print ("mySQL server name: $mysql_host\n"); |
print ("mySQL server name: $xx_host\n"); |
59 |
print ("mySQL user name: $mysql_user\n"); |
print ("mySQL user name: $xx_user\n"); |
60 |
|
|
61 |
print ("Continue with install? WARNING: This will DROP any databases \n"); |
print ("Continue with install? WARNING: This will DROP any databases \n"); |
62 |
print ("named libdata, libstats, and session on the specified mySQL\n"); |
print ("named libdata, libstats, and session on the specified mySQL\n"); |
71 |
|
|
72 |
# dump existing libdata, libstats, session |
# dump existing libdata, libstats, session |
73 |
print ( "Dropping libdata, libstats, and session databases!\n" ); |
print ( "Dropping libdata, libstats, and session databases!\n" ); |
74 |
`cat drop.sql | mysql -u$mysql_user -p$mysql_pwd`; |
`cat drop.sql | mysql -u$xx_user -p$xx_pwd`; |
75 |
|
|
76 |
# create new databases |
# create new databases |
77 |
print ("Creating new libdata, libstats and libsessions databases.\n"); |
print ("Creating new libdata, libstats and libsessions databases.\n"); |
78 |
`cat create.sql | mysql -u$mysql_user -p$mysql_pwd`; |
`cat create.sql | mysql -u$xx_user -p$xx_pwd`; |
79 |
|
|
80 |
print ("Populating libdata tables & data.\n"); |
print ("Populating libdata tables & data.\n"); |
81 |
`cat libdata.sql | mysql -u$mysql_user -p$mysql_pwd libdata`; |
`cat libdata.sql | mysql -u$xx_user -p$xx_pwd libdata`; |
82 |
|
|
83 |
print ("Populating libstats tables.\n"); |
print ("Populating libstats tables.\n"); |
84 |
`cat libstats.sql | mysql -u$mysql_user -p$mysql_pwd libstats`; |
`cat libstats.sql | mysql -u$xx_user -p$xx_pwd libstats`; |
85 |
|
|
86 |
print ("Populating libsession tables.\n"); |
print ("Populating libsession tables.\n"); |
87 |
`cat libsession.sql | mysql -u$mysql_user -p$mysql_pwd libsession`; |
`cat libsession.sql | mysql -u$xx_user -p$xx_pwd libsession`; |
88 |
|
|
89 |
# refresh/reload grants tables |
# refresh/reload grants tables |
90 |
print("Reloading and refreshing the mySQL grants tables.\n"); |
print("Reloading and refreshing the mySQL grants tables.\n"); |
91 |
`mysqladmin -u$mysql_user -p$mysql_pwd refresh`; |
`mysqladmin -u$xx_user -p$xx_pwd refresh`; |
92 |
`mysqladmin -u$mysql_user -p$mysql_pwd reload`; |
`mysqladmin -u$xx_user -p$xx_pwd reload`; |
93 |
|
|
94 |
# The "done" message |
# The "done" message |
95 |
print ("\nInstallation steps finished. Script terminated.\n"); |
print ("\nInstallation steps finished. Script terminated.\n"); |