DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

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

questorfla

  • Fighting Slime all the Time
  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
Creating an empty MySQL db from within a batch script
« on: November 15, 2014, 02:07 AM »
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.

4wd

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: Creating an empty MySQL db from within a batch script
« Reply #1 on: November 15, 2014, 05:24 AM »
Shades answered this on one of your previous quests, his command file has the commands to create a database.
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903

Original address: https://www.donationcoder.com/forum/index.php?topic=39563.0