Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • October 24, 2016, 05:52:04 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Creating an empty MySQL db from within a batch script  (Read 779 times)


  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 506
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Creating an empty MySQL db from within a batch script
« on: November 14, 2014, 08:07:24 PM »
I once had this working but I have misplaced the exact procedure.  It was a short one or two line sequence that ran at the front of an install script that created an empty database ready to be loaded.
The first line allowed input of the DB name and the second created the empty DB inside the correct folder.  The only prerequisite is the collation format is preferred to use Latin1_swedish_ci.  The rest of the field loading and parameters is done later in the script but it assumes the empty DB is already there. 

It is a lot faster to do during the creation script than to use PHPMyAdmin or similar to create the DB then exiting to run the other script to load the tables.
Unfortunately, I have not used this is a couple years and do not remember the exact sequence to get it to work but I do remember it took quite a while to find the right setup to run from inside a batch file even though the task itself is rather simple.


  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,448
    • View Profile
    • Donate to Member
Re: Creating an empty MySQL db from within a batch script
« Reply #1 on: November 14, 2014, 11:24:09 PM »
Shades answered this on one of your previous quests, his command file has the commands to create a database.