Click here to Skip to main content
15,171,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have tried time and again to set up multiple SQL services on a Linux machine and I cannot get it to work. Does anyone have an easy solution? what worked for you?

What I have tried:

I'm in tutorial hell for the Linux Terminal..
Posted
Updated 12-Oct-21 7:44am

Apart from what others have answered in their solutions, if you intended to use Microsoft SQL Server on Linux, then you can download it and use their Developer edition.

Installation guidance for SQL Server on Linux - SQL Server | Microsoft Docs[^]
   
See this overview: relational-databases[^]
I would recommend PostgreSQL, there even seems to be a portable version: PostgreSQL Portable download | SourceForge.net[^]
You might also be interested in this article: Managing Multiple PostgreSQL Instances on Ubuntu/Debian - DZone Database[^]

An easier option might be to use a: postgresql-as-a-service-provider[^]
And if your needs are simple: LiteDB[^]
   
v3
If you want something really simple for single user use then try SQLite Home Page[^].
   
The exact instructions will depend on which version of Linux you are using. Assuming you are using a Debian derived distribution (e.g Debian, Ubuntu, RPIOs, etc), the following should get you a PostgreSQL database installed and ready to use. We start by assuming that you can log in as user 'myuid' and have sudo access.
Shell
#start by checking which version of postgresql is available for your distribution
[myuid@myhost]:~ $ apt list postgresql-*
#This will produce a long list of available packages.  You want to look for something that looks like postgresql-13/hirsute-updates,hirsute-security 13.4-0ubuntu0.21.04.1 amd64
#This is for Ubuntu 21.10, your version might be postgresql-11 or posgresql-12, or perhaps even postgresql-9 if you are using an older distribution.
#Now install the postgresql package
[myuid@myhost]:~ $ sudo apt install postgresql-13
#this will download, install and initialize the database engine for you
#in order for the user 'myuid' to get access, you will need to create a myuid user and a myuid database
[myuid@myhost]:~ $ sudo su - postgres -c "createuser myuid"
[myuid@myhost]:~ $ sudo su - postgres -c "createdb myuid"
#You should now be able to access the database via the psql command.
[myuid@myhost]~ $ psql 
psql (13.4 (Ubuntu 13.4-0ubuntu0.21.04.1), server 12.8 (Ubuntu 12.8-0ubuntu0.20.04.1))
Type "help" for help.

myuid=> /q
[myuid@myhost]~ $

The procedure for other databases are similar. If you choose to use MySQL/MariaDB or Firebird, you'll have to do some research on how to create users and databases and what the CLI command is for them. Another possibility is to uses SQLite, which has some limitations since it is not a full DBMS - but if you're only interested in learning SQL, its a good place to start.
Note that the 'postgresql-13' package does not include any of the development packages. If you are wanting to do programming, you will, at a minimum, want to install postgresql-server-dev-13 package. Replace 13 with 11, 12 or 9 as per your installed postgresql package. You may then want to add python or C++ or other language support, if available, if you are looking at using something other than programming in C
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900