Distribute applications with Mysql

0

Does anyone know how to distribute the application and mysql database together?

I'm using Innosetup, until I can install mysql, start the service but when I connect it gives error saying that I can not connect. See the inno code:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "ServerSisEscola"
#define MyAppVersion "1.0"
#define MyAppPublisher "ServerSisEscola"
#define MyAppURL "http://"
#define MyAppExeName "MyProg.exe"

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{6AF944A0-16EF-4099-8AA7-6FC0F023D9E5}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName=C:\{#MyAppName}
DisableDirPage=yes
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes

[Languages]
Name: brazilianportuguese; MessagesFile: compiler:Languages\BrazilianPortuguese.isl

[Files]
Source: D:\tcc Sis_escola\Sistema_Escola\Sistema_Escola\bin\Debug\Banco\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs
Source: D:\tcc Sis_escola\Sistema_Escola\Sistema_Escola\bin\Debug\Banco\IniciarServico.bat; DestDir: {app}; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}

[Tasks]
Name: ServidorSisEscola; Description: Servidor Sistema Escola; Flags: exclusive
[Run]
Filename: {app}\IniciarServico.bat; Flags: waituntilidle

After that it opens a .bat to configure:

cd bin
mysqld --install Mysql_SistemaEscola --defaults-file="C:\ServerSisEscola\my.ini")
net start Mysql_SistemaEscola
cd bin
mysql -u root -p 3308 -h localhost SistemaEscola.sql <SistemaEscola.sql

I've copied the entire mysql folder to the directory of my application according to this tutorial but it did not work, I can not connect.

    
asked by anonymous 22.01.2015 / 19:41

1 answer

0

It does not connect because your database was not created, MySQL was installed but it did not create your database because there is an error in the .bat file on the line:

"mysql -u root -p 3308 -h localhost SistemaEscola.sql < SistemaEscola.sql"

Should be:

mysql -uroot -pTUASENHA -h localhost < SistemaEscola.sql

or

mysql --user=root --password=TUASENHA -h localhost < SistemaEscola.sql

And in SchoolSchool.sql there should be one:

create database NOMEDOTEUBANCO;

Only if the bank was previously created could it be used:

mysql -uroot -pTUASENHA -h localhost NOMEDOTEUBANCO < SistemaEscola.sql
    
08.05.2015 / 20:48