Datagrip import & export table structure and data

right click directly next to the database you want to export and select dump with ‘mysqldump’


add the -d argument to the automatically generated command to export only the table structure without the data! if you want to export a file containing data, plus the -d parameter can be broken…

if the local mysqldump version is higher, for example, my local version is 8.0 and the target data source version is lower, the export will fail :

mysqldump: Couldn't execute 'SELECT COLUMN......

solution: add –column-statistics=0 to solve the problem

if you want to export the entire database that contains the data; Alternatively, use the command

at terminal

mysqldump -u root -p source1 > source2.sql

where source1 is the name of the database to be exported and

is the data name of the exported source.sql

import the exported source2.sql into the database using the following command :

/source/XXX XXX source2. SQL

where source2.sql is the data to be imported

before import , first to enter mysql, then to build a database, such as database, then into the database, finally execute the above command can be

Read More: