'Copy MySQL Workbench query output to clipboard

I've used Microsoft SQL Server Management Studio and one feature allowed me to run an SQL script and copy the output table to my clipboard. Something like this:

enter image description here

When I right click on my output table in MySQL Workbench, I can only copy the row content.

Does anyone know how to copy the whole table including headers?



Solution 1:[1]

Follow these steps in the workbench to get the data and the header rows into Excel.

  1. Click on the box to the left of the first column on any data record.
  2. Click on the header on the box to the left of the column headers.
  3. Do a Ctrl+C to copy the data to the clipboard.
  4. Do a Ctrl+V to paste the data to your excel file.

Like so:

Visual Example for Step 1 & 2

Solution 2:[2]

You may have an old version of MySQL Workbench. I can press Ctrl+A on Win or Cmd+A on Mac to select all records. Then Ctrl/Cmd+C to copy to clipboard (or use the "Copy Row" entry which should probably just be named "Copy").

Solution 3:[3]

In the Workbench you go to File > Export > Forward Engine SQL CREATE Script and this will guide you through three easy steps to create the SQL script for the complete shema.

Solution 4:[4]

screenshot of mysql workbench corresponding to the info below

On Mac, hit cmd+a to select all

Then right-click and select "copy row (with names, tab separated)"

This will copy all of the data in the rows, as well as the header/column names. And it will be formatted to past into excel.

I assume this would work similarly on Windows, but I can't confirm that since I only have a Mac.

Solution 5:[5]

Vishal's answer is absolutely correct:

  1. Click on the box to the left of the first column on any data record.
  2. Click on the header on the box to the left of the column headers. Do a
  3. Ctrl+C to copy the data to the clipboard. Do a Ctrl+V to paste the
  4. data to your excel file.

But if the cells content exceeds the maximum number of bytes configured in the Max. Field Value Length to Display in (in bytes) setting, this will copy only the content showing including the ellipsis.

This setting is located at Edit > Preferences > SQL Editor > SQL Execution

enter image description here

If the results are being truncated, in order to copy the entire result, adjust this value to whatever size you need to display to full cell contents for copying, or set a value of -1 to avoid truncation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 anon
Solution 2 Mike Lischke
Solution 3 Jan Mensen
Solution 4 abryeans
Solution 5 Andrew