GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   execute sql file in php? (https://gfy.com/showthread.php?t=778350)

Bro Media - BANNED FOR LIFE 10-22-2007 01:27 AM

execute sql file in php?
 
I've been trying to get this to work for a long fucking time and its pissing me off, anyone have an idea how to beable to take a sql dump from phpmyadmin, and just run it via a local php script, not phpmyadmin and make it work just the same?

Bro Media - BANNED FOR LIFE 10-22-2007 12:56 PM

nobody knows?

nicedreams 10-22-2007 01:12 PM

Look at this:

php-mysql-tutorial.com/perform-mysql-backup-php.php

Jimmy

Bro Media - BANNED FOR LIFE 10-22-2007 01:25 PM

Quote:

Originally Posted by nicedreams (Post 13270931)
Look at this:

php-mysql-tutorial.com/perform-mysql-backup-php.php

Jimmy

that works to an extent i just keep getting this

"Table 'wpjm.wp_comments' doesn't exist"

because there is nothing in the table, so how can i do it with a blank database?

SCORE Ralph 10-22-2007 01:43 PM

If there is nothing on the table, what is it you're trying to dump?

Bro Media - BANNED FOR LIFE 10-22-2007 02:55 PM

trying to dump a sql file to create tables and shit

2012 10-22-2007 03:21 PM

Quote:

Originally Posted by Jaysin (Post 13271050)
that works to an extent i just keep getting this

"Table 'wpjm.wp_comments' doesn't exist"

because there is nothing in the table, so how can i do it with a blank database?

i know this sounds really fucking dumb but ...
whatever you're using is missing that step.

You need to create the table before you can populate it.

Create Table ...
insert into ....

Chariott 10-22-2007 04:46 PM

Not sure I understand it completely :) but which SQL file would you like to get executed? If you have a large dump and phpmyadmin just halts, it is much better to use mysqldump via ssh and direct its output to a file. Such as:

/usr/local/bin/mysqldump --all-databases --user=NAME --password=PASS > my-dump.sql

You can simply import this dump.sql (which is full of queries) into mysql later again using /usr/local/bin/mysql utility.

I hope this will help :)

latinasscash 10-22-2007 05:41 PM

It sounds to me like when you are doing your database
dump, you are not using the create table option. That
way or a load/restore, it will create the tables if they
do not already exist.

Bro Media - BANNED FOR LIFE 10-23-2007 10:44 AM

well, the first line in the sql dump is "CREATE TABLE `wp_comments`"

so i guess it works, but the command in that example requires you to set a table to dump to, which i had to set it to something thats not there due to having no tables in the database

pretty much what im trying to do is make a script that all i give is mysql login info, a database name, and it will do what the sql file says, which is a bunch of create tables and insert into tables, the sql file is a mysql dump from wordpress


All times are GMT -7. The time now is 05:22 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123