Results 1 to 5 of 5

Thread: How to use Batch Files to Create MySQL Database?

  1. #1
    Join Date
    Jul 2006
    Posts
    273

    How to use Batch Files to Create MySQL Database?

    Hello Friends,
    I am trying to make the batch file that can create database of MySQL. I ahve tried a lot but of no use.!! So lastly I thought that some guys will help me over her, so I posted my query over here. Can anyone tell me how to use Batch Files to Create MySQL Database? Please help me as soon as possible.!!
    (\__/)
    (='.'=) This is Bunny. Copy and paste bunny into your
    (")_(") signatureto help him gain world domination

  2. #2
    Join Date
    Mar 2008
    Posts
    672

    Re: How to use Batch Files to Create MySQL Database?

    You can do anything by using the Batch file. Te following things can be done in MySQL by using the batch files :
    • You can create the tables.
    • You can create a new database.
    • Stored procedures and functions can also be created.
    • You can populate the tables with data.
    • You can run queries also.

    The advantage of a batch file for creating a MySQL database is :
    1. You can come to know what have been done by using the batch files.
    2. A batch file means that databases are reproducible - either at another time or in another place

  3. #3
    Join Date
    Apr 2008
    Posts
    1,948

    Re: How to use Batch Files to Create MySQL Database?

    There are many things that can be done shortly by using the batch files. You should be knowing that the common things that database developer has to do is :
    1. All of the SQL commands are stored in a text file.
    2. Use the mysql command to run the SQL commands in the file.

    The batch file for creating the MySQL Database on Windows would be like
    c:\sql\create_database.sql

  4. #4
    Join Date
    Jul 2006
    Posts
    289

    Re: How to use Batch Files to Create MySQL Database?

    You can have a look at the following coding which is useful for making SQL code for Creating a MySQL Database :
    The first lines of the batch file will need to contain the commands for creating the database itself:
    Code:
    drop database if exists suite11_data;
    create database suite11_data;
    use suite11_data;
    The above mentioned codes does :
    • deletes the database if it already exists
    • it then creates the database
    • and then it moves the user into the newly created (but empty) database.
    Signatures reduce available bandwidth

  5. #5
    Join Date
    Jan 2008
    Posts
    1,521

    Re: How to use Batch Files to Create MySQL Database?

    The following is a SQL Code for Creating a Stored Procedure in a MySQL Database :
    Code:
    delimiter //
    create procedure new_user (in fname varchar(25), in add varchar(25), in place varchar(25), in office_name varchar(25))
    begin
    declare o_id int;
    select id into o_id from office
    where name = office_name;
    insert into user (firstname, address, place, office_id)
    values
    (fname, add , place , o_id);
    end
    //
    delimiter ;

Similar Threads

  1. Create a batch (. Bat) MS-DOS to delete files
    By Aarya in forum Software Development
    Replies: 9
    Last Post: 08-09-2011, 12:58 AM
  2. How to create MySQL Database and Tables in PHP?
    By Orton in forum Software Development
    Replies: 4
    Last Post: 23-02-2010, 06:45 AM
  3. Replies: 3
    Last Post: 07-11-2009, 09:36 PM
  4. how to create and restore mysql database using vb 6.0
    By nanakofiboafo in forum Software Development
    Replies: 1
    Last Post: 14-09-2009, 09:18 AM
  5. Batch insert on MySQL is possible
    By Shreevats in forum Software Development
    Replies: 3
    Last Post: 16-05-2009, 06:13 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,720,878,862.15214 seconds with 17 queries