Installing MS-SQL on CentOS 7

Posted Leave a comment

This setup is using an instance within Google Cloud Platform’s Compute Engine, but it should work about anywhere running CentOS 7+. I added this here because I needed to try mssql on Centos, an unsupported distro. Other howto’s online I found did not work, or did not completely set it up in a usable form. This worked great for me. Let me know if you have issues.

Installing mssql server in linux

gcloud compute ssh instancename

obtain root

sudo su -
cd /etc/yum.repos.d/

grab the repo file(s) with wget, and store it/them in /etc/yum.repos.d/


you might want to grab the cli client for linux as well. You can grab the repo here:


now we’ll install mssql-server-2017 and the cli-client

sudo yum install mssql-server-agent mssql-server

and install the command line client:

sudo yum install mssql-cli

At this point, ms-sql is installed. We need to set up the new server.

cd /opt/mssql/bin/
./mssql-conf setup

you should be greeting with the following screen to pick your license.

[root@ms-sql bin]# ./mssql-conf setup
Choose an edition of SQL Server:  
  1) Evaluation (free, no production use rights, 180-day limit)
  2) Developer (free, no production use rights)
  3) Express (free)
  4) Web (PAID)
  5) Standard (PAID)
  6) Enterprise (PAID)
  7) Enterprise Core (PAID)
  8) I bought a license through a retail sales channel and have a product key to enter.

Details about editions can be found at

Use of PAID editions of this software requires separate licensing through a  
Microsoft Volume Licensing program.  
By choosing a PAID edition, you are verifying that you have the appropriate  
number of licenses in place to install and run this software.

Enter your edition(1-8): 3  
The license terms for this product can be found in  
/usr/share/doc/mssql-server or downloaded from:

The privacy statement can be viewed at:

Enter the SQL Server system administrator password:  
Confirm the SQL Server system administrator password:  
Configuring SQL Server...

The licensing PID was successfully processed. The new edition is [Express Edition].  
ForceFlush is enabled for this instance.  
ForceFlush feature is enabled for log durability.  
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/mssql-server.service.  
Setup has completed successfully. SQL Server is now starting.  

The wizard will walk you though picking your licenses, and sa password. Once the password is set, SQL server will start, licensed

[root@ms-sql bin]# mssql-cli 
Username (press enter for sa):
Version: 0.13.0

Dump a mysql table without locking

Posted Leave a comment

If you want to keep your site/application live, you can dump mysql tables online like so:

mysqldump --single-transaction --quick -hhostname -uuser -ppassword database > /path/to/destination-sqlbackup.sql

–compress = as it says, enabled compression on the connection to the mysql server. This will always speed up bulk loads 10x vs. using uncompressed connections.

–single transaction = Issue a BEGIN SQL statement before dumping data from server

–quick = This option is useful for dumping large tables. It forces mysqldump to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out.



-p password = password

Importing your dump is pretty easy too:

Inserting your backup back to the Mysql server is simple too:

cat destination-sqlbackup.sql | mysql -hhostname -uuser -ppassword database
enabling compression by default via /etc/my.cnf

add compress to your config like so each section needs it to enable default: