Using the command line on Linux
Published 22 August 2019
SQL Compare Command Line can now be used on Linux. Linux support is currently in beta, and is available through Docker Hub.
To access the Linux command line directly, grab the latest from our download site.
Differences from Windows
- The backslash
'\'
is an escape character in bash. You should therefore specify the server as/server1:Widget_Server\\SQL2008
when using the Linux commandline. - The filesystem in a container is isolated from the rest of the system. You should use
--mount
to pass directories through to SQL Compare, for example when working with scripts folders and project files. - The container is also separate from your host machine in terms of network addresses. You should use the name or IP address of your host machine instead of localhost when connecting to local SQL instances.
- You should ensure you run docker commands as a member of the
docker
group (or alternatively as root). - Our license can be found at https://www.red-gate.com/support/license/. You will need to indicate that you accept it with the
/IAgreeToTheEULA
switch. - Active Directory authentication is not supported on Linux.
- Static data may work, but is not currently well tested on Linux.
Beta release
While we work on our Linux licensing solution, a "timebomb" has been applied which will cause the product to stop working 180 days after it was built.
Example commands to run SQL Compare through Docker on Linux
To compare a live database to an empty target
docker run --rm --interactive --tty \ redgate/sqlcompare:14 /IAgreeToTheEULA \ /s1:my-server\\sql2019 /db1:my-database /u1:sa /p1:my-password /empty2
To generate a creation script for a live database
docker run --rm --interactive --tty \ --mount type=bind,src=/home/me,dst=/scripts \ redgate/sqlcompare:14 /IAgreeToTheEULA \ /s1:my-server\\sql2019 /db1:my-database /u1:sa /p1:my-password /empty2 /scriptfile:"/scripts/script.sql"
To compare a live database to a scripts folder
docker run --rm --interactive --tty \ --mount type=bind,src=/home/me/scriptsfolder,dst=/scriptsfolder \ redgate/sqlcompare:14 /IAgreeToTheEULA \ /s1:my-server\\sql2019 /db1:my-database /u1:sa /p1:my-password /scripts2:"/scriptsfolder"