Solved

Using winfows 7 and 10 download en install MYSQL server from a batch

Posted on 2016-10-25
13
177 Views
Last Modified: 2016-11-14
Is it possible to download and install MYSQL server (if possible latest version) within a batch file

Thanks Danny
0
Comment
Question by:Danny Kon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
  • 2
13 Comments
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 41859468
Hi!

You should take a look at the MYSQL Installer  which basically downloads the product for you and  you could use it to automate install and/or upgrade of MySQL Server using batch script.

https://dev.mysql.com/doc/refman/5.5/en/windows-installer-msi-quiet.html
https://dev.mysql.com/doc/mysql-installer/en/MySQLInstallerConsole.html

Here is a link to a tutorial of the MySQL Installer GUI
http://www.mysqltutorial.org/install-mysql/
to get familiar with what it can do.

You can then use the MySQLInstallerConsole in a PowerShell batch script. :)

Regards,
     Tomas Helgi
0
 
LVL 6

Author Comment

by:Danny Kon
ID: 41859823
Thomas,

But is it also possible to download and install the installer from the internet by batch

Danny
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 41859842
Hi!

I have not tried that. By running the GUI installer you could see what products are available through it. If the installer itself is part of the productlist you should be able to download and install/upgrade it using the installer and in a batch as well.

Regards,
     Tomas Helgi
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:Danny Kon
ID: 41859932
Thomas

the command
msiexec /i http://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-community-5.7.16.0.msi /passive
Does download the file direct from the internet but now i need to know how to find the package (the name will change)and wait till is downloaded and then to install the package

I want to
download and install MySQL
and put an DB to the system
Something like underneath but then it has to work :)
msiexec /i http://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-community-5.7.16.0.msi /passive
msiexec /i mysql-5.7.16.0.msi /passive
mysql -u root -p < dbname.sql

Thanks Danny
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 41860081
Hi!

The MySQLInstallerConsole, as I pointed out earlier, has a LIST parameter that list all available products that can be downloaded through the installer and installed/upgraded.
Usually a download from internet through a batch program is directed to "current directory" which the batch session was invoked in unless you change the "current directory" path in your batch script which you then can monitor in the script.

Regards,
    Tomas Helgi
0
 
LVL 6

Author Comment

by:Danny Kon
ID: 41860330
Tomas,

Thanks for your answer and this give me direction but it doesn't solve my problem

I really need the batch

Something like underneath but working

set installer="C:\Program Files (x86)\MySQL\MySQL Installer for Windows\MySQLInstallerConsole.exe"
set version=5.7.16.0
echo -----------------------
echo Details
echo -----------------------
echo Server User: root
echo.
echo Server Password: %password%
echo.
echo Configuration Folder: %installer%
echo.
echo Version: %version%
echo -----------------------
echo Start Installation
echo.

msiexec /i "%~dp0\mysql-installer-community-%version%.0.msi" /qb

%installer% community installserver;%version%;X64:*:port=3307;openfirewall=true;passwd=%password% -silent
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 41860623
Hi!

Regarding the Installer itself. Have you checked if the Installer is in the product list in the GUI ?
You will need to download the first Installer yourself and distribute it to other servers using a batch script.
If the installer is in the list then you can after the initial install of the MySQLInstaller upgrade it on the server that the batch is running on.
For the MySQL Server you first install the server then you configure after a successfull install.

Regards,
    Tomas Helgi
0
 
LVL 6

Author Comment

by:Danny Kon
ID: 41865407
Thomas,

The installer and the software is not the problem, the problem is the batch

Thx Danny
0
 
LVL 78

Expert Comment

by:arnold
ID: 41881503
Directly attempting to run an installer from internet source will likely be blocked by UAC.
How often do you need to do this that it requires this type of aitomation?
Is this a donain based setup such that you could deploy the package using GPO software deployment.
Though automating upgrades while often straight forward, one has to look at the changes to make sure features one might rely in are no longer available in the newer version.

Download to a central local repository and deploy/install it from the local location.
0
 
LVL 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 250 total points
ID: 41881802
0
 
LVL 6

Author Comment

by:Danny Kon
ID: 41884719
arnold,

Sorry for the late respons, as you can see in my example its no need to install it direct from the internet
I can install the software on a local environment and do it from there
I have a POS system need to be installed 10 / 20 times per week on different low budget PC's  with windows 7 and 10  
The thing i want to accomplish is install a standard mysql and copy the POS DB to mysql

Example:
set installer="C:\Program Files (x86)\MySQL\MySQL Installer for Windows\MySQLInstallerConsole.exe"
set version=5.7.16.0
echo -----------------------
echo Details
echo -----------------------
echo Server User: root
echo.
echo Server Password: %password%
echo.
echo Configuration Folder: %installer%
echo.
echo Version: %version%
echo -----------------------
echo Start Installation
echo.
msiexec /i "%~dp0\mysql-installer-community-%version%.0.msi" /qb
%installer% community installserver;%version%;X64:*:port=3307;openfirewall=true;passwd=%password% -silent
mysql -u root -ppassword < dbname.sql

Thomas, again thanks for helping but this is to much general info i need somebody to help me with the batch or translate this to Powershell

Thanks Danny
0
 
LVL 78

Assisted Solution

by:arnold
arnold earned 250 total points
ID: 41884762
I am not sure what you are asking.
Set sets/defines variables.

Use the batch as a reference. Are you running this batch/installer from a USB/network?
Do you build the POS systems from scratch, any though of creating an os images that you then deploy with the MySQL/db already installed?
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question