Re: [CSCMail-Users] MySQL
Brought to you by:
countzer0
|
From: Steven K. <st...@vo...> - 2000-08-16 13:23:45
|
On 16 Aug 2000 09:31:34 CEST, Olli said:
> Daniel,
> I did the same and also like the speed :-)
> I got my adressbook from CSV with the migration-script dbswitch.pl
> from
> the <cscmail-dir>/migration-scripts directory. How ever I had to
> change
> the line
>
> $conn=&open_db_conn;
>
> to something like
>
> $conn=DBI->connect("DBI:mysql:database=databasename;host=localhost",
> "dbuser", "dbpassword",{'RaiseError' => 1});
>
> Also I commented out the following line:
>
> # &create_database;
If run properly (from the cscmail directory, as specified in the docs) no
modifications at all are needed to this script, it will create the new
database for you and everything.
Run it like this:
(assuming you un-tarred CSCMail into /usr/src/cscmail )
[/usr/src/cscmail] ./migration-scripts/dbswitch.pl CSV mysql
Notice that we are NOT in /usr/src/cscmail/migration-scripts running
./dbswitch.pl we are in the CSCMail directory, running
./migration-scripts/dbswitch.pl this is important, since dbswitch.pl
uses csclib.pl... You have to run dbswitch.pl from a directory that
contains csclib.pl
You do NOT need to manually make your empty database if you do this.
dbswitch.pl will make it for you.
This will copy all tables... Filters, Messages, Addresses, Accounts, etc
from the old database to the new one. If you have already manually done
some parts of this migration, I do not recommend running dbswitch,
because it assumes that there is no new database yet. I strongly suspect
it will FAIL if you run it against an already setup database (which is
what Daniel has.) Therefore, I recommend that Daniel use the mysqlimport
method that Mark proposed to the list.
dbswitch is designed to be run before you change .cscmailrc to point to
the new db. So, full instructions for switching from CSV to another db
are as follows:
Download and install SQL db of choice (Postgres, MySQL, etc)
use DB's administration utility to make an empty DB with the same name as
your username. (in postgres its: createuser <username> and possibly
(depending on the version) createdb <username> Consult mysql doc's or
CSCMail INSTALL doc's for other db's)
The following steps install the Perl DBD for your Database:
perl -MCPAN -e shell
install DBD::Pg (or DBD::mysql etc)
quit
Now we run dbswitch:
cd /location/of/cscmail
./migration-scripts/dbswitch CSV Pg (or CSV mysql, etc)
NOTE: DBD's are CaSe SeNsItIvE CSV must be all caps, mysql is all
lowercase, and Postgres is "Pg".
Now we edit ~/.cscmailrc changing the line DatabaseDriver: CSV to
DatabaseDriver: Pg or mysql or whatever... remember case sensitivity.
If your using MySQL and you need to put in DatabaseUser: and
DatabasePassword: do so at this time. (They should be there, but empty)
Now you are finally ready to run CSCMail. It should pop-up just like it
did before, only faster. Everything should be fine, all data should be
there. Once you have confirmed this, you can safely delete the
~/.cscmail/messages ~/.cscmail/folders ~/.cscmail/filters ... files
(Anything that when you cat it looks like a Comma Seperated Value
file...) DON'T delete any directories.
-CZ
--
----------------------------------------------------------------------
Steve Kordik st...@vo...
System Administrator Tel 212.332.5045
VOILA - France Telecom North America Fax 212.332.2362
1270 Avenue of the Americas New York, NY 10020 USA
----------------------------------------------------------------------
Customized Search Engines for your web site at: http://voilasearch.com
----------------------------------------------------------------------
|