David,

> Or is there perhaps a "RENAME DATABASE" command (I saw RENAME TABLE)

in MySQL 4.1, you will find "ALTER DATABASE":
http://www.mysql.com/documentation/mysql/bychapter/manual_News.html#News
-4.1.0

Regards,
--
  Stefan Hinz <[EMAIL PROTECTED]>
  Geschäftsführer / CEO iConnect GmbH <http://iConnect.de>
  Heesestr. 6, 12169 Berlin (Germany)
  Tel: +49 30 7970948-0  Fax: +49 30 7970948-3

----- Original Message -----
From: "David T-G" <[EMAIL PROTECTED]>
To: "mysql users" <[EMAIL PROTECTED]>
Sent: Saturday, December 28, 2002 2:15 AM
Subject: style question: "drop database" in an install script


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi, all --
>
> I'm working up the schema for my application and, as you can imagine,
> starting over and reloading numerous times :-)  In fact, I intend for
the
> script to be an install script, run on a new installation of the
software
> to set things up.
>
> The script starts out
>
>   drop database if exist dbname ;
>   create database dbname ; use dbname ;
>   create table tablename
>   (
>     ...
>   ) ;
>   ...
>
> to set things up and then continues
>
>   insert into tablename (field,field,field)
>     ( data , data , data ) ,
>     ...
>     ( data , data , data ) ;
>   ...
>
> to set up the predefined things (credit card types and so on).
>
> To reload the database and try something new, all I have to do is
>
>   mysql -udroot -p < script.sql
>
> and what was there goes away and is rebuilt fresh.  That's mighty
> convenient as I'm building up a table's design and trying it out.
>
> Soooooo...  When you experienced folks write software that's meant to
be
> installed from a script or such, do you lead off with a 'drop
database'
> command, or is that just too dangerous to put in a script and you make
> your users clean up any old installation by hand?  This will have to
be
> run by a root user, so we can figure that this user might have read
the
> docs and know that he's going to start [over] from scratch, but then,
> again, users are users :-)
>
> Meanwhile, is there if/then/else functionailty in SQL so that I can
say
>
>   if exist dbname exit "some error" ;
>   create database dbname ;
>   ...
>
> and not try to create and populate a database on top of an existing
one?
> Or is there perhaps a "RENAME DATABASE" command (I saw RENAME TABLE)
so
> that I could rename the old one to get it out of the way but not toss
it?
>
>
> TIA & HAND
>
> mysql query,
> :-D
> - --
> David T-G                      * There is too much animal courage in
> (play) [EMAIL PROTECTED] * society and not sufficient moral
courage.
> (work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and
Health"
> http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl
Npg!
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.7 (FreeBSD)
>
> iD8DBQE+DPsqGb7uCXufRwARAsp8AKC7BuVdyO7Dl5fkbvEM51o+i/BAEgCeI5iI
> dI7HQb5oywLHuZIjLxXYZwY=
> =QTHL
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to