Hi All,

I am using MySql and wrote all my create table scripts directly on the command line client. Now I have no tracks of them. I need all the table scripts present in my database region for future reference. I used the below command to view the script of one of my table :

show create table tablename;

It displays the script for tablename. Can Anybody guide me in collecting all the scripts present in the region, into one file?

Mysql comes with a command line tool called mysqldump . You can use it to export your tables and/or data into an .sql file.

Hi pritaeas,

Thanks for ur help.

I checked this command but its not working. where this file will be created? Is there any pre-requisite ?? suppose my database name is "DBase" and it has 2 tables A and B. How should I use the command so as to get the script of these tables into an output file.

Sorry pritaeas,

:(

Nothing is working. I tried everything but its showing syntax error.

Hello,

Try:

mysqldump -u root -p DBase > outfile.sql

it will prompt you for the root password and create a file in the current directory called outfile.sql

Hi,

I tried this code. To end the command I gave ';' and it gave me syntax error.

Because it is not sql code but a command line executable. Run it from the command prompt.

Thanks a lot everyone .... It worked

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.