Contents
How do I run a SQL script in Linux?
Create a sample database
- On your Linux machine, open a bash terminal session.
- Use sqlcmd to run a Transact-SQL CREATE DATABASE command. Bash Copy. /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -Q ‘CREATE DATABASE SampleDB’
- Verify the database is created by listing the databases on your server. Bash Copy.
How do I run a .SQL file in Terminal?
Run SQL file in MySQL database from terminal?
- After pressing OK button, you will get a command prompt. …
- Now reach the bin directory, the snapshot is as follows:
- Here is my file ‘mydb. …
- Now you can type the above syntax which I have discussed to run SQL file.