Check if there is a mysql server on the network with CMD?

1

I'm trying to create an installer with Inno Setup which installs a Server or Terminal from a point of sale, the problem is that when I install a terminal I need to verify if the database exists in the specified Host (Server) to be able to move forward.

The way I achieve and get closer to what I want to do is by running the mysqldump.exe :

mysqldump.exe -uroot -pjavac -P3500 -h10.1.12.79 baseDatos

The problem I have is that I do not want to create a backup, I just need to check if the base exists or not, with some light command line program.

Is there a tool that can verify the existence of a database and can run it by CMD similar?

    
asked by Angel Montes de Oca 20.07.2017 в 00:46
source

1 answer

2

You can use mysql so for example:

mysql.exe --host=HOST --user=USER --password=PASS --execute="SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'DB_NAME'"

If the base:

  • Does not exist The result will be empty.
  • If it exists , it will return a row.
answered by 20.07.2017 / 04:40
source