Solved

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

Posted on 2016-10-25
13
64 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
  • 5
  • 5
  • 2
13 Comments
 
LVL 24

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 24

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
 
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 24

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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 24

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 76

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 24

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 76

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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now