View Full Version : database delete / database import
wooolF[RM]
02-23-2002, 08:35 PM
]Hi, I have a database (old one) that I want to drop from MySQl server with this php file :
<?
system ("mysql -h hosthere -u loginhere --password=passhere -e "drop database databasenamehere"; phpinfo();
?>
^^^doesn't work... anyone got any idea?
after that I need to import a backed up database to this place with this php file :
<?
system ("mysql -h hosthere -u loginhere --password=passhere databasenamehere < dump.sql");
phpinfo();
?>
^^ works just fine...
Can anybody can me with script that drop the whole database at once? Thanx
wooolF[RM]
02-23-2002, 09:08 PM
]very helpfull community... :D
I found a script...
<?
mysql_connect("hostname","username","password");
$query = "DROP DATABASE databasenamehere";
$result = mysql_query($query);
phpinfo();
?>
but now damn import script doesn't work... darn! :/
wooolF[RM]
02-24-2002, 02:43 PM
]still noone? :D
I need import script that works......
Admin
02-24-2002, 02:46 PM
Have you tried creating the database first, before importing into it?
wooolF[RM]
02-24-2002, 04:08 PM
well... that's actually the problem...
as U have seen from delete script, I have just dropped database...
Now I can't import any data as database doesn't exist... And I really don't know how to create one. I know it's easy for all of u to say go to google or MySQL hp and look there. But I think for some of u are much more easier to give 3-4 lines script.
Please help. Thanx
Admin
02-24-2002, 04:15 PM
mysql_query("CREATE DATABASE databasename");
wooolF[RM]
02-24-2002, 04:18 PM
]so something like:
<?
mysql_connect("hostname","username","password");
mysql_query("CREATE DATABASE databasename");
$result = mysql_query($query);
phpinfo();
?>
and then I should run this script :
<?
system ("mysql -h hosthere -u loginhere --password=passhere databasenamehere < dump.sql");
phpinfo();
?>
and I'm done? :supwink:
Admin
02-24-2002, 04:23 PM
Remove
$result = mysql_query($query);
phpinfo();
from the first code, and remove the call to phpinfo() from the second.
wooolF[RM]
02-24-2002, 04:29 PM
]who's your daddy?! FireFly is! LOL :D
Thanx a lot! Everything works! GJ!
Admin
02-24-2002, 04:35 PM
I have a son?
wooolF[RM]
02-24-2002, 04:38 PM
]:D :D :D :D :D :D :D
^^^^ OFFTOPIC ^^^^
;)
Stretchr
03-03-2002, 03:22 PM
I really need this script but the import portion of the script is not importing the sql dump file. Here's what I used:
<?
mysql_connect("localhost","dbusername","dbpassword");
mysql_query("CREATE DATABASE dbname");
system ("mysql -h localhost -u dbusername --password=dbpassword dbname < webdjnet.sql");
?>
I ran the drop script first, then this one. The database is created but nothing imports. I would really appreciate any help. Thanks!
:confused:
Courage
06-22-2002, 10:04 PM
I Also have this problem... i have a 85 Mb sql file on my ftp and no wey to import it :@
Plase help !!!!!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.