Scripting...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thomas

    #1

    Scripting...

    Good Day,

    This is probably a stupid question.... Here goes. I am working at the
    command line in linux... Is there a way to write a simple "batch" type
    file using a standard text editor?

    <------Begin Script--------->

    mysql -u root -ppassword;
    create database somedatabase;
    use somedatabase;
    create table sometable;
    blah, blah, blah?

    <------ End Script --------->

    I have a need to create databases, add users, build tables... I am now
    using phpmyadmin but would like to just build an install script...
    This would take installation of our projects from an hour or so to
    minutes.

    Any help would be appreciated... Don't worry about the syntax... I
    will look that up... I just can't get past

    mysql -u root -password

    I get a mysql prompt> Good, but not what was intended... I didn't
    want to have to resort to attempting to build a C prog.

    I just want to work from the shell...

    Thanks in advance,
    Thomas
    Hellopages.com
  • joecooker

    #2
    Re: Scripting...

    admin@hellopage s.com (Thomas) wrote in message news:<52eb30d6. 0311261821.532b 6f88@posting.go ogle.com>...[color=blue]
    > Good Day,
    >
    > I have a need to create databases, add users, build tables... I am now
    > using phpmyadmin but would like to just build an install script...
    > This would take installation of our projects from an hour or so to
    > minutes.[/color]

    Please give your attention to the mysql backups manager (
    http://www.indexsoft.com/dbmanagerpro/ ). It can execute any sql
    commands in an sql text script. In your case only you have to do is
    create text file with sql commands and use manager to 'restore' DB
    from it. Of course the main purpose of the manager is backup and
    restore DB, but no one forbid to use it as you wish.

    Joe

    Comment

    • joecooker

      #3
      Re: Scripting...

      admin@hellopage s.com (Thomas) wrote in message news:<52eb30d6. 0311261821.532b 6f88@posting.go ogle.com>...[color=blue]
      > Good Day,
      >
      > I have a need to create databases, add users, build tables... I am now
      > using phpmyadmin but would like to just build an install script...
      > This would take installation of our projects from an hour or so to
      > minutes.[/color]

      Please give your attention to the mysql backups manager (
      http://www.indexsoft.com/dbmanagerpro/ ). It can execute any sql
      commands in an sql text script. In your case only you have to do is
      create text file with sql commands and use manager to 'restore' DB
      from it. Of course the main purpose of the manager is backup and
      restore DB, but no one forbid to use it as you wish.

      Joe

      Comment

      • John

        #4
        Re: Scripting...


        I've installed a few PHP "portal" frameworks from the web and they each
        have had a text file containing SQL to generate the tables and insert
        data automatically. IIRC, it was as simple as running "mysql <
        script.sql" from the command-line, after the database was created.

        John


        Thomas wrote:
        [color=blue]
        > Good Day,
        >
        > This is probably a stupid question.... Here goes. I am working at the
        > command line in linux... Is there a way to write a simple "batch" type
        > file using a standard text editor?
        >
        > <------Begin Script--------->
        >
        > mysql -u root -ppassword;
        > create database somedatabase;
        > use somedatabase;
        > create table sometable;
        > blah, blah, blah?
        >
        > <------ End Script --------->
        >
        > I have a need to create databases, add users, build tables... I am now
        > using phpmyadmin but would like to just build an install script...
        > This would take installation of our projects from an hour or so to
        > minutes.
        >
        > Any help would be appreciated... Don't worry about the syntax... I
        > will look that up... I just can't get past
        >
        > mysql -u root -password
        >
        > I get a mysql prompt> Good, but not what was intended... I didn't
        > want to have to resort to attempting to build a C prog.
        >
        > I just want to work from the shell...
        >
        > Thanks in advance,
        > Thomas
        > Hellopages.com[/color]

        Comment

        • John

          #5
          Re: Scripting...


          I've installed a few PHP "portal" frameworks from the web and they each
          have had a text file containing SQL to generate the tables and insert
          data automatically. IIRC, it was as simple as running "mysql <
          script.sql" from the command-line, after the database was created.

          John


          Thomas wrote:
          [color=blue]
          > Good Day,
          >
          > This is probably a stupid question.... Here goes. I am working at the
          > command line in linux... Is there a way to write a simple "batch" type
          > file using a standard text editor?
          >
          > <------Begin Script--------->
          >
          > mysql -u root -ppassword;
          > create database somedatabase;
          > use somedatabase;
          > create table sometable;
          > blah, blah, blah?
          >
          > <------ End Script --------->
          >
          > I have a need to create databases, add users, build tables... I am now
          > using phpmyadmin but would like to just build an install script...
          > This would take installation of our projects from an hour or so to
          > minutes.
          >
          > Any help would be appreciated... Don't worry about the syntax... I
          > will look that up... I just can't get past
          >
          > mysql -u root -password
          >
          > I get a mysql prompt> Good, but not what was intended... I didn't
          > want to have to resort to attempting to build a C prog.
          >
          > I just want to work from the shell...
          >
          > Thanks in advance,
          > Thomas
          > Hellopages.com[/color]

          Comment

          • Thomas

            #6
            Re: Scripting...

            Thank you sir!

            I now have enough info to complete the task...

            The mysql < script.sql is something I missed... Great way to load a sql sequence.

            Thanks again!
            Thomas



            John <nosapm@topleve l.tld> wrote in message news:<P_Bxb.272 81$Wy4.5866@new sread2.news.atl .earthlink.net> ...[color=blue]
            > I've installed a few PHP "portal" frameworks from the web and they each
            > have had a text file containing SQL to generate the tables and insert
            > data automatically. IIRC, it was as simple as running "mysql <
            > script.sql" from the command-line, after the database was created.
            >
            > John
            >
            >
            > Thomas wrote:
            >[color=green]
            > > Good Day,
            > >
            > > This is probably a stupid question.... Here goes. I am working at the
            > > command line in linux... Is there a way to write a simple "batch" type
            > > file using a standard text editor?
            > >
            > > <------Begin Script--------->
            > >
            > > mysql -u root -ppassword;
            > > create database somedatabase;
            > > use somedatabase;
            > > create table sometable;
            > > blah, blah, blah?
            > >
            > > <------ End Script --------->
            > >
            > > I have a need to create databases, add users, build tables... I am now
            > > using phpmyadmin but would like to just build an install script...
            > > This would take installation of our projects from an hour or so to
            > > minutes.
            > >
            > > Any help would be appreciated... Don't worry about the syntax... I
            > > will look that up... I just can't get past
            > >
            > > mysql -u root -password
            > >
            > > I get a mysql prompt> Good, but not what was intended... I didn't
            > > want to have to resort to attempting to build a C prog.
            > >
            > > I just want to work from the shell...
            > >
            > > Thanks in advance,
            > > Thomas
            > > Hellopages.com[/color][/color]

            Comment

            • Thomas

              #7
              Re: Scripting...

              Thank you sir!

              I now have enough info to complete the task...

              The mysql < script.sql is something I missed... Great way to load a sql sequence.

              Thanks again!
              Thomas



              John <nosapm@topleve l.tld> wrote in message news:<P_Bxb.272 81$Wy4.5866@new sread2.news.atl .earthlink.net> ...[color=blue]
              > I've installed a few PHP "portal" frameworks from the web and they each
              > have had a text file containing SQL to generate the tables and insert
              > data automatically. IIRC, it was as simple as running "mysql <
              > script.sql" from the command-line, after the database was created.
              >
              > John
              >
              >
              > Thomas wrote:
              >[color=green]
              > > Good Day,
              > >
              > > This is probably a stupid question.... Here goes. I am working at the
              > > command line in linux... Is there a way to write a simple "batch" type
              > > file using a standard text editor?
              > >
              > > <------Begin Script--------->
              > >
              > > mysql -u root -ppassword;
              > > create database somedatabase;
              > > use somedatabase;
              > > create table sometable;
              > > blah, blah, blah?
              > >
              > > <------ End Script --------->
              > >
              > > I have a need to create databases, add users, build tables... I am now
              > > using phpmyadmin but would like to just build an install script...
              > > This would take installation of our projects from an hour or so to
              > > minutes.
              > >
              > > Any help would be appreciated... Don't worry about the syntax... I
              > > will look that up... I just can't get past
              > >
              > > mysql -u root -password
              > >
              > > I get a mysql prompt> Good, but not what was intended... I didn't
              > > want to have to resort to attempting to build a C prog.
              > >
              > > I just want to work from the shell...
              > >
              > > Thanks in advance,
              > > Thomas
              > > Hellopages.com[/color][/color]

              Comment

              Working...