Deploy applications with Mysql

Asked

Viewed 531 times

0

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

I’m using Innosetup, I can even install mysql, start the service but when I connect it gives error saying I can not connect. See the code of the Internet:

; 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 copied the entire mysql folder to the directory of my application according this tutorial but it didn’t work, I can’t connect.

  • Puts the exact Mysql error in your question which makes it easier to find out what the problem is.

  • This is the error ERROR 2003 (HY000): Can’t connect to Mysql server on 'localhost' (10061)

  • 1

    You changed the Mysql port to 3308? The standard is 3306.

  • Right. I switched to 3306 and contained the error. I forgot to mention this

  • 1

    Are you sure that Mysql has been started? Take a look at the events log, something may have gone wrong. Please put your file my.ini.

  • Another thing I realized now: -p is the parameter to ask for the password to be entered. To specify the port you have to use -P [PORTA] (P maíusculo) or --port [PORTA]

  • hello Vinicius Gobbo A. de Oliveira, thank you very much for the return. It does not fit all file. # The TCP/IP Port the Mysql Server will Listen on port=3306 #Path to installation directory. All paths are usually resolved relative to this. basedir="C: Serversisescola bin" #Path to the database root datadir="C: Serversisescola Data"

Show 2 more comments

1 answer

0


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 the.sql Systemsschool there should be one:

create database NOMEDOTEUBANCO;

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

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.