Esquema de exportación MySQL sin datos
Estoy usando una base de datos MySQL con un programa Java, ahora quiero darle el programa a alguien más.
¿Cómo exportar la estructura de la base de datos MySQL sin los datos en ella, solo la estructura?
10 answers
Puede hacerlo con la opción --no-data
con el comando mysqldump
mysqldump -u root -p --no-data dbname > schema.sql
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-09-08 13:10:45
Sí, puedes usar mysqldump
con la opción --no-data
:
mysqldump -u user -h localhost --no-data -p database > database.sql
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-05-30 11:09:32
También puede extraer una tabla individual con la opción --no-data
mysqldump -u user -h localhost --no-data -p database tablename > table.sql
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-03-11 13:19:55
Puede usar la opción-d con el comando mysqldump
mysqldump -u root -p -d databasename > database.sql
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-04-01 11:17:31
Dumping sin utilizar la producción.
mysqldump --no-data <database name> --result-file=schema.sql
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-24 09:36:45
Puede Utilizar La Herramienta de Administrador MYSQL es gratuita http://dev.mysql.com/downloads/gui-tools/5.0.html
Encontrarás muchas opciones para exportar tu base de datos MYSQL
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-05-30 11:10:40
En caso de que esté utilizando IntelliJ, puede habilitar la vista de base de datos (Vista -> Ventana de herramientas -> Base de datos)
Dentro de esa vista conéctese a su base de datos. Luego puede hacer clic derecho en la base de datos y seleccionar "Copiar DDL". Otros IDE pueden ofrecer una función similar.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-11-12 17:17:54
Para obtener el script de creación de una tabla individual:
- seleccione toda la tabla (con la tecla mayús)
- simplemente haga clic derecho en el nombre de la tabla y haga clic en Copiar al portapapeles > Crear instrucción.
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-10-26 10:01:27
Tenga en cuenta que la opción no no-data no incluirá la definición de vista. Así que si yo tenía una vista como seguir
crear vista v1
seleccione a
.id
COMO id
,
a
.created_date
COMO created_date
desde t1;
con la opción no no-data, la definición de la vista se cambiará a la siguiente
crear vista v1
seleccione 1 COMO id
, 1 COMO created_date
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-21 17:50:00
Puede tomar utilizando el siguiente método
mysqldump -d <database name> > <filename.sql> // -d : without data
Espero que te ayude
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-01-09 07:04:13