Questions tagged [command-line]
A command line is a string given to a command interpreter that tells it actions to take, such as running programs or copying files. The interpreter processes command lines with escapes and substitutions.
121 questions
1
vote
1
answer
65
views
mysql ORDER BY return order differently
Trying to figure out why mysql's ORDER BY clause can return order differently, e.g.:
The two files are both generated by using mysql on command line with a single command:
mysql mydb -e 'SELECT ...
0
votes
1
answer
62
views
Why is mycli history file appearing in home directory?
I started using mycli and want $HOME/.mycli-history to be generated and updated from $HOME/.cache/mycli/.mycli-history
Moved $HOME/.myclirc -> ~/.config/mycli/.myclirc
Created alias mycli='sudo ...
0
votes
1
answer
80
views
Sqlcmd: The -W and the -y/-Y options are mutually exclusive
I am working on SQL server task. I need a sqlcmd result file with complete records with headers.
Here is the command and error message below
sqlcmd -S [Server_Name] -U [User_Name] -P [Password] -d [...
0
votes
0
answers
64
views
Bitnami mongod fails with 'MongoServerSelectionError'
Bitnami's Mongo image launched under virtualbox works and brings up the text console (debian11 so no X11). Debian instance starts the listener correctly according to ss -atpn. But starting mongosh ...
1
vote
1
answer
392
views
Why should I prefer Invoke-DbaQuery to its alternatives?
The documentation for Invoke-DbaQuery mentions many other similar functions
This function is a wrapper command around Invoke-DbaAsync, which in turn is based on Invoke-SqlCmd2. It was designed to be ...
0
votes
0
answers
104
views
Postgresql refuses connect from Windows psql
I've been fiddling with these for 3 hours now and I can't figure out why my PostgreSQL server on a Debian server accepts connections from my Ubuntu server but not from my
Windows 10 or 11 machines.
...
0
votes
1
answer
306
views
command line client included in "SQL Server Management Studio 19"
With a web search I found that sqlcmd is included in SQL Server.
Is there a command line client included in "SQL Server Management Studio 19"?
I wish to run some SQL scripts in an automated ...
1
vote
1
answer
500
views
Set 'timing on' for the duration of the current `psql` session using command-line options
What is the equivalent of \timing on command in psql, using the psql command-line options? I am aware that this will enable timing for all psql sessions:
echo '\\timing on' >> ~/.psqlrc
I am ...
1
vote
0
answers
210
views
How to use mongoexport with a dynamic variable for date on windows batch file?
Here is my working script:
mongoexport --db db1 --collection Transaction --out C:\Users\Admin\transactionstats.json --query="{"PaymentDate":{"$gte":{"$date":"...
0
votes
1
answer
4k
views
Run both of "DROP DATABASE" and "CREAT DATABASE" in CLI with "-c" option of psql of Postgresql
When debugging programs, I need to frequently drop a database of Postgresql, and then re-create it again.
To convenient, I want to execute this in a single command line like following:
psql -c "...
0
votes
0
answers
159
views
How do I retain command history for psql running within PowerShell?
I'm running the following version of psql
psql (12.11)
on Windows Powershell running on Windows 10. Within the same shell session, when I log in and out of psql, it doesn't retain the previous ...
0
votes
1
answer
4k
views
In Postgres 12, how do I set a default schema when logging in using psql?
I'm logging in to my Postgres 12 (running on Windows 10) db using an alias, which resolves to
PGPASSWORD=$DB_PASSWORD psql -U${DB_USER} $DB_NAME
I would like to find a way to tell Postgres which ...
-3
votes
1
answer
780
views
Is it possible to access a Windows MSSQL server from an instance of Linux?
I'm trying to assess the viability of using Linux within a very-much Windows environment for bash/scripting utilities to be performed. From the documentation I could find, ubuntu access is possible ...
3
votes
1
answer
765
views
How to tell SqlPackage.exe to create object existence check script?
I have this code that creates a migration script for me:
First Part (Extract)
sqlpackage /a:extract
/of:true
/scs:"Data Source =.; Initial Catalog = Accounts; user id = ...
0
votes
1
answer
3k
views
How do I escape characters when running COPY command on command line?
I'm using Postgres 14 on CentOS 7. I would like to run a copy command from a bash script. I first tried running the command on the command line
$ PGPASSWORD=$DB_PASS psql -U $DB_USER -d $DB_NAME -c '...
0
votes
1
answer
5k
views
How can I create a mysql database (if it doesn't exist) or replace it (if it exists)?
My dump:
mysqldump --host=localhost --user=root --password=whatever --single-transaction --routines --triggers --log-error=error.txt --databases mydatabase > out.sql
My restore
mysql --host=...
0
votes
1
answer
5k
views
Why can't I use command \i on psql? It says no such file or directory [closed]
I am trying to use command \i 'C:\Users\Public\person.sql'; on windows on psql.
And it says C:UsersPublicperson.sql: No such file or directory
Although file does exist. I tried to relocate file on ...
0
votes
2
answers
636
views
Equivalent Linux commands for Windows ones to create user and database
There is a manual for configuring PostgreSQL on Windows with these commands:
C:\"Program Files"\PostgreSQL\12\bin\createuser.exe --username=postgres --superuser --pwprompt saleor
C:\"...
1
vote
1
answer
2k
views
SQLite command line shell stuck on ...> , CTRL+D not working
I've just started learning Databases, and the instructor is teaching SQLite with the command line shell. I downloaded sqlite-tools-win32-x86-3350400.zip from sqlite.org/download
When I enter false ...
1
vote
1
answer
2k
views
Upgrading Postgres 12 to 13: 'pg_upgrade.exe' fails
I'm attempting to upgrade a Postgres instance from version 12 to version 13, following the steps outlined at https://www.postgresql.org/docs/13/pgupgrade.html.
From an elevated command prompt, I'm ...
1
vote
1
answer
578
views
sql command utility version is not working
I have two versions of SQL Command Utility installed on my system as mentioned below(I checked the versions by going to Control Pannel->ProgramsandFeatures).
Microsoft Command Line Utilities 11 ...
0
votes
0
answers
195
views
Auto running SQL script with Azure database server
I am trying to automate a report that is generated from the database on Azure database server. I am using below script in the batch file but I get the error.
Script:
osql -U firstname.lastname@company....
0
votes
2
answers
845
views
MySQL server will not start/stop
I am currently in the process of setting up a database in MySQL for an application where I will be running PowerBI to do analyses on the data in the database and in a further stage to design an ...
2
votes
3
answers
446
views
Retain indent formatting when compiling a stored procedure without Data Studio
When I compile a stored procedure using CLPplus console (or even in dBeaver), all indentation is stripped out. Only when I compile in Data Studio is the formatting retained, but I would like to ...
1
vote
1
answer
1k
views
Cannot Reset MySQL password
I have been stuck on this for a long time, I tried to follow the instructions located here: https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html. When I run the commands I get this as my ...
6
votes
2
answers
11k
views
How to Skip Existing Data While Restoring mysqldump File?
I use this query to import data using MySQL Dump (Command Prompt / Command Line)
mysql -u root -p database_name < database_name.sql
I want to import the large database (only new deltas) as of now ...
0
votes
0
answers
555
views
Import table data using multiple sql file in psql
Local Machine(l1):
Windows 10
psql
Remote Machine(R1):
linux
EDB(postgres)
On my local I have 1000+ sql script containing insert statement . psql is also installed locally .
I need to run this sql ...
2
votes
1
answer
4k
views
How to load data from another sql file into a main sql file? - MYSQL
I am trying to process the scripts dbcreate_f.sql and dbload_f.sql to create and to load data into a script solution6.sql.
I am doing this in MYSQL command line.
In solution6.sql I have two statements:...
2
votes
1
answer
4k
views
How can I ONLY get the query execution time on the command line without waiting till the data is displayed?
I am testing and comparing execution times of queries with big result sets using the command line.
It takes too long to display the result set! Is there any way to see only the query execution time ...
2
votes
1
answer
337
views
Is there a difference between running the source command from the mysql command line client and '<' from outside it? if so, when should I use each?
I can run the following commands:
C:\myfolder>mysql -uuser -ppassword
Then from within the client do:
mysql>source C:\path\to\file.sql
Or I can do:
C:\myfolder>mysql -uuser -...
1
vote
1
answer
172
views
can I exclude or delete .pem files in backup data myqdl?
I am making a backup of the mysql data folder. In this folder are the databases. The method I am using is described in this post which uses ROBOCOPY
During installation, mysql (tested in 5.7.30) ...
1
vote
1
answer
6k
views
PowerShell script to send an email with SQL results in HTML format
Does anyone have a PowerShell script to query results from a SQL Server database and send it out as an email in HTML format?
2
votes
1
answer
2k
views
Need help trying to run a batch file from a SQL Agent job
I am trying to run a batch file from a SQL Agent job. This batch file is a connection command and script file that will run. I can run the the actions straight from Command Prompt, but I need it to be ...
3
votes
2
answers
16k
views
How to print results in SQLcmd window
I'tm trying to show in SQLcmd window the results of these queries:
SELECT SYSDATETIME() AS "date";
PRINT 'EXTRAÍDO POR:'
SELECT SUSER_NAME() AS "Owner"
PRINT 'PASSWORD SETTINGS';
exec ...
-1
votes
1
answer
1k
views
Problems running Postgres "createuser" command
I'm trying to run the createuser command on an MacOS 10.15 installation of Postgres 11.6. I have enabled root but there is no postgres user to su as - there's a _postgres user instead:
dd@finglas:~ $ ...
0
votes
1
answer
291
views
How do I skip an offline database over the network in MySQL import?
I am doing a MySQL import from an *.sql file to multiple database location over the network. I'm using cmd batch file to run the command and it's working as I expect it to be. However I notice that ...
1
vote
0
answers
937
views
Is it possible to reset SA password without stopping SQL Server Service?
I lost a password for sa account. Now I want to reset SA password and at the same time not to restart SQL Server Service or going into single-user mode. I would like to mention that I am windows ...
0
votes
1
answer
69
views
Trying to run lines on a timer
One of the things I need to do on my job is run lines of SQL code. I need to do each line individually. Which involves highlighting one line, executing it, then doing the next. Sometimes it is up ...
1
vote
0
answers
664
views
How to enforce ON DELETE RESTRICT on MySQL?
This is my SQL code:
-- DROP the database if it exists
DROP DATABASE IF exists labtest;
-- CREATE THE DATABASE
CREATE DATABASE labtest;
-- SHOW DATABASES;
SHOW DATABASES;
-- Use the database
USE ...
0
votes
0
answers
65
views
MariaDB pipped querys not executed
I experience a strange problem on our 3 node MariaDB cluster (10.2.24). Queries send over the command line are received by the cluster but don't get executed. MySQL does not return any errors or ...
1
vote
1
answer
773
views
MySQL Error: Data Too Long For Column CHAR(5) - MariaDB 10.3.10 [closed]
When inserting data from CSV to MariaDB 10.3, the following error is generated while trying to insert value '00010' into NCHAR(5) column
ERROR 1406 (22001): Data too long for column '...
0
votes
1
answer
2k
views
Mysql Command line Parameter passing to sql file
In windows mysql(5.7 version),
I want to run mysql commmand using command line for .sql file as input .
Also i was to pass some variable whose value should get used in .sql file.
somehow I am not able ...
3
votes
1
answer
609
views
How to tell whether mysql was built with libedit or readline?
How to tell whether mysql was built with libedit or readline?
I'm trying to configure the mysql client tool to use Ctrl-R for searching command history but not sure which input library my ...
1
vote
2
answers
9k
views
how to stop OracleRemExecServiceV2 from cmd?
I have Oracle 12c running on Windows 7.
When I look at the Oracle's specific services (Control Panel\System and Security\Administrative Tools\Services), I have the following 6 services:
So far, ...
3
votes
1
answer
3k
views
How do I force windows to use a specific version of SQLCMD?
I have several versions of SSMS installed on my machine. We have legacy servers running several versions of SQL Server, mainly 2008, 2012, and 2014. I use SQLCMD all the time, but it seems to default ...
3
votes
1
answer
7k
views
How to format the output of SQL queries on SQLCMD for SQL Server 2017 on RHEL Linux 7.3?
I have installed SQL Server 2017 on RHEL Linux 7.3, and using SQLCMD utility for querying the SQL Server.
When I try to query for example: 'SELECT * FROM SYS.DATABASES'. I get output like the ...
0
votes
1
answer
1k
views
How to get useful error information from mysql command?
I'm trying to script the creation of a database with tables. I'm encountering errors but the error messages are not helpful to me because I'm a novice.
I'm finding the mysql tool is providing mostly ...
0
votes
1
answer
533
views
How to deploy install of MS SQL Server 2017 Developer Edition via command-line script - not working
I'm trying to deploy MS SQL Server 2017 Developer Edition via command-line script from a server share that holds the install media onto Windows 10 1803 (June release). However, I'm not having much ...
0
votes
1
answer
36
views
Show cassandra help documentation in terminal instead of browser
I've just started playing around with Cassandra through the cqlsh cli. When using the help command for the topics the documentation opens in the browser. Is there a way to show the documentation in ...
0
votes
1
answer
152
views
mysql (5.5.) cmd unresponsive when selecting a huge db
I had initiated on Friday night a huge (~800G) dump from my machine to a remote host;
Today, (although the command does not seem to have returned yet), I am able to log in to the machine and mysql ...