At 02:32 PM 3/26/2002, you wrote:
>Hi, I'm new to this list, hopefully, I can contribute some wisdom :)
>
>At the moment, I have to update a large database to be multi-company-ready,
>so I basically have to add a Column "Company_ID" to nearly each table.
>
>What would be the easiest way to do this?
>
>I already thought about running a "SELECT *" Query for each table, saving
>the result in an Array (in PHP, btw, it's a webapplication), dropping the
>table, creating the new table and looping through the data to insert the
>data again. Problem is, that this puts a heavy task on the server, I tried
>it on a local "crash"-server, and even with carefully planned setting and
>unsetting of the arrays, it eats up the RAM since the arrays just get damn
>big. And since I have to remote control the server and it is important that
>the server is online nearly 24/7, I risk to crash the server without having
>the physical option to reboot it until the next morning...a few hundred
>kilometres away from my workplace...

Yikes! :(
I don't think you want to do it this way. Unless your car has plenty of gas 
and you can outrun your boss's car. ;-)


>Now I am looking into two things:
>
>1) is there some kind of "MODIFY" query I can run???

"ALTER TABLE tablename ADD columnname  ...". See 
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#ALTER_TABLE. 



>2) or is it possible to dumb the database, drop it, create the new structure
>and then write the dumb back in with some options that it ignores the
>"CREATE TABLE" queries and that it doesn't check if the count of the values
>matches the count of the columns? (error I get when I try to do it at the
>moment).

Too complicated.


>3) another way...
>
>As you can see, I am not THAT experienced with MySQL, so any help is greatly
>appreciated!!!

If you want to modify a database remotely, try PHPMyAdmin from 
http://www.phpwizard.net/projects/phpMyAdmin/. It's free.

Of course make a backup before you do anything!! See 
http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Database_Administration.html#Backup.

You can greatly enhance your confidence with MySQL just by reading the 
manual http://www.mysql.com/documentation/mysql/bychapter/. You can also 
download a PDF version and read it offline. Also Paul Dubois's book "MySQL" 
is quite good and has plenty of examples.

Word to the wise. Never trust a surgeon who operates with a chainsaw. Read 
the manual so you know which tools to use. Yes it may take you a week to 
get through it, but your confidence will grow and you won't be accidentally 
amputating any of your body parts in the process (and neither will your Boss!).

Brent


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


---------------------------------------------------------------------
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