List all databases from command line

We use a simple batch file for backups that does a mysqldump on each
database on our MySQL 5.0 server. When we create a new database on the
server, though, we need to modify the batch file, which is easy to forget.

Is there a way, using a command-line program, that I can get a list of all
databases on the server so that I can loop over the list and backup each
one?


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32 [at] m.gmane.org
James Eaton [ Fr, 14 September 2007 08:08 ] [ ID #1820391 ]

RE: List all databases from command line

Something like

mysql -u root -p --execute=3D"SHOW Databases" mysql

Should get you what you want. There may be some other options to give
you the output in a form and place that suits you.

John Bonnett

-----Original Message-----
From: Jim [mailto:jj [at] zolx.com]
Sent: Friday, 14 September 2007 3:38 PM
To: win32 [at] lists.mysql.com
Subject: List all databases from command line

We use a simple batch file for backups that does a mysqldump on each
database on our MySQL 5.0 server. When we create a new database on the
server, though, we need to modify the batch file, which is easy to
forget.

Is there a way, using a command-line program, that I can get a list of
all databases on the server so that I can loop over the list and backup
each one?



--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32 [at] m.gmane.org
John.Bonnett [ Fr, 14 September 2007 08:31 ] [ ID #1820393 ]

Re: List all databases from command line

Thanks. I figured out that I could also loop over subfolders in the MySQL
data directory to give me each of the database names.


----- Original Message -----
From: "Bonnett, John" <John.Bonnett [at] vision.zeiss.com>
To: <jj [at] zolx.com>; <win32 [at] lists.mysql.com>
Sent: Friday, September 14, 2007 12:31 AM
Subject: RE: List all databases from command line


Something like

mysql -u root -p --execute="SHOW Databases" mysql

Should get you what you want. There may be some other options to give
you the output in a form and place that suits you.

John Bonnett

-----Original Message-----
From: Jim [mailto:jj [at] zolx.com]
Sent: Friday, 14 September 2007 3:38 PM
To: win32 [at] lists.mysql.com
Subject: List all databases from command line

We use a simple batch file for backups that does a mysqldump on each
database on our MySQL 5.0 server. When we create a new database on the
server, though, we need to modify the batch file, which is easy to
forget.

Is there a way, using a command-line program, that I can get a list of
all databases on the server so that I can loop over the list and backup
each one?


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32 [at] m.gmane.org
James Eaton [ Fr, 14 September 2007 09:19 ] [ ID #1820394 ]

RE: List all databases from command line

You can also use --skip-column-names to make the output a little
cleaner.

Peace,
Scott

-----Original Message-----
From: Bonnett, John [mailto:John.Bonnett [at] vision.zeiss.com]
Sent: Friday, September 14, 2007 2:32 AM
To: jj [at] zolx.com; win32 [at] lists.mysql.com
Subject: RE: List all databases from command line

Something like

mysql -u root -p --execute="SHOW Databases" mysql

Should get you what you want. There may be some other options to give
you the output in a form and place that suits you.

John Bonnett

-----Original Message-----
From: Jim [mailto:jj [at] zolx.com]
Sent: Friday, 14 September 2007 3:38 PM
To: win32 [at] lists.mysql.com
Subject: List all databases from command line

We use a simple batch file for backups that does a mysqldump on each
database on our MySQL 5.0 server. When we create a new database on the
server, though, we need to modify the batch file, which is easy to
forget.

Is there a way, using a command-line program, that I can get a list of
all databases on the server so that I can loop over the list and backup
each one?



--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe:
http://lists.mysql.com/win32?unsub=scott.c.harrison [at] lmco.com


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32 [at] m.gmane.org
scott.c.harrison [ Fr, 14 September 2007 17:40 ] [ ID #1820397 ]
Datenbanken » gmane.comp.db.mysql.windows » List all databases from command line

Vorheriges Thema: InnoDB
Nächstes Thema: Installing MySQL on Vista