Reputation: 153
Is it possible to copy all my DB tables to another DB but without the field values. Soo an empty DB just with tables names and links.
My situation :
I'm developing a web page with a DB(MySql Workbench) in parallel. In that DB I put only fake information and did on local on my PC.
Soo now its time to do it in real with real information >< Soo I wanna tranfert only the tables of my DB in the new server, a copy wouldn't be fine becaucse it will copy also all the fake values :/
Soo is it possible ?
ps : I can't delete all my values because of all PK et FK constraint I declared -_-
Upvotes: 0
Views: 289
Reputation: 69440
You can make a dump from your database without data. See the mysql documentation. There is a switch --no-data which dumps only the table structure:
--no-data, -d
Do not write any table row information (that is, do not dump table contents). This is useful if you want to dump only the CREATE TABLE statement for the table (for example, to create an empty copy of the table by loading the dump file).
Upvotes: 0
Reputation: 10336
You could use mysqldump with the no-data option
mysqldump --no-data
--no-data, -d
Do not write any table row information (that is, do not dump table contents). This is useful if you want to dump only the CREATE TABLE statement for the table (for example, to create an empty copy of the table by loading the dump file).
Upvotes: 0
Reputation: 201
There are several ways to go about this.
Use SHOW CREATE TABLE db.tableName; to get the structure of the table, repeat for all tables needed.
Use MySql dump to dump the table structure which looks like this
mysqldump -d -h localhost -u root -p databasename > dumpfile.sql
Upvotes: 1