Hi,
I would like to enable the user to backup his tables. I could do that by making a system call to mysqldump (which does what I want), but it is not allowed to do system calls on the web hotel in question.

I don't feel comfortable letting the user have access to mysqladmin, so thats not the way to go.

How can I achieve this by making my own script? As far as I know, there is no selection statements that give the same output as mysqldump does. Can you help?

Thanks,
Per

    Hi,

    It is possible - you could look at the script that.

    Probably best if you include a drop table if exists first:

    Output:

    DROP TABLE IF EXISTS tablename;

    Then get the create which can be got by using the following sql:

    SHOW CREATE TABLE tablename;

    Then you could query the database to create the insert statements.

    However, couldn't you use php to run mysqldump from the command line - I saw this class here that will do it all for you...

    Backup my database

      Yeah, SHOW FIELDS will also tell you a lot about the table structure, then just a lot of SELECT statements...

        RossC0:
        Thanks a lot for your help - i'll try that!

        As I mentioned, I cannot user mysqldump as I don't have the rights to do so. Anyway, with your help I can now make my own script :-)

          Write a Reply...