Thread: schem help...
View Single Post

   
  #2 (permalink)  
Old 02-27-2008, 09:34 PM
Rolando Edwards
 
Posts: n/a
Default Re: schem help...

The mysql client program never generates the fixed length, pipe layout from the shell's command line.
This is only possible at mysql's command line.

1) Try this:

my -Ae "show tables;" | while read a ; do my -Ae "show create table $a"; echo >>
myfile.txt ; done

2) Try mysqldump in this manner

mysqldump --no-data [database] > myfile.txt

This will export the schema only using 'DROP TABLE IF EXISTS ...'
and 'CREATE TABLE ...' syntax for every table in a given database.
If database is not specified, the schema of every database, and the
'CREATE TABLE ...' for all tables per schema are exported.

3) Try using the INFORMATION_SCHEMA database

Create a SQL script (myschema.sql) using the following SQL command in it

select CONCAT('show create table `',t.table_schema,'`.`',t.table_name,'`;')
from INFORMATION_SCHEMA.tables t where t.table_schema = '<database>';

If you are doing all databases, try this:

select CONCAT('show create table `',t.table_schema,'`.`',t.table_name,'`;')
from INFORMATION_SCHEMA.tables t order by t.table_schema,t.table_name;

Then, from the shell, do this:

mysql < myschema.sql > myfile.txt

----------------------------------------------------

All of these solutions will generate the SQL for schema creation.
Try these out. I hope they help.

Have a good day.

----- Original Message -----
From: Payne <payne@magidesign.com>
To: mysql@lists.mysql.com
Sent: Monday, October 16, 2006 2:20:55 AM GMT-0500 US/Eastern
Subject: schem help...

Hi,

I need some help. I got a 161 tables that I am trying to create schem
on, the problem is I can get any of my boxes to show you know

+---+
| |
+---+

Here is the command I am doing....

my -Ae "show tables;" | while read a ; do my -Ae "desc $a"; echo >>
myfile.txt ; done

what I get the desc with out the boxes.

Can someone help me? I need the box because I am going to cut these
tables out so I can map out the relatation to them.

Thanks,

Payne

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=redwards@swmx.com


Reply With Quote