Results 1 to 6 of 6

Thread: Creating tables from an .sql file

  1. #1

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Question Creating tables from an .sql file

    My Web Hosting allows me one MySQL database. I can't rename it, delete it, or overwrite it. At the moment, it has no tables.
    I have 2 .sql files each containing CREATE TABLE statements. My Web Hosting tech support has told me i need MySQL Workbench to upload 2 tables. I've tried the migration wizard, but i know i'm doing it wrong, no results... Can anyone guide me through this?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Creating tables from an .sql file

    Have you installed MySQL Workbench? It's not exactly the same but it's much like SQL Server Management Studio.

  3. #3

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Creating tables from an .sql file

    I have MySQL Workbench. I have no idea how to import a table (from a .sql file) into my existing database. MySQL Workbench is my only option, but I have no idea how to use it...

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Creating tables from an .sql file

    You just open the SQL file in Workbench and execute it against the database, basically the same as you do in SSMS for SQL Server. The CREATE TABLE statement will create the create the table, just as an INSERT statement would insert a record, etc.

  5. #5

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Creating tables from an .sql file

    Ok. I was using the wrong version of Workbench. I'm now using 6.3.1 and i've been able to import one of my table schemas.
    The MySQL version i'm using is 5.1.5 and has a problem with...

    Code:
    `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
    CURRENT_TIMESTAMP wasn't available in that version of mySQL. What can i replace it with?

  6. #6

    Thread Starter
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Creating tables from an .sql file

    Thanks for the help. I was using the wrong version of workbench. Once I installed version 6.3.1 I got it working...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width