![]() |
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?
|
nobody knows?
|
Look at this:
php-mysql-tutorial.com/perform-mysql-backup-php.php Jimmy |
Quote:
"Table 'wpjm.wp_comments' doesn't exist" because there is nothing in the table, so how can i do it with a blank database? |
If there is nothing on the table, what is it you're trying to dump?
|
trying to dump a sql file to create tables and shit
|
Quote:
whatever you're using is missing that step. You need to create the table before you can populate it. Create Table ... insert into .... |
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 :) |
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. |
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