We would to create user, run query through mgconsole non-interactively
Steps to reproduce
mgconsole “show users ;” so we can see the users
(Write your steps here:)
Step 1: mgconsole
Step 2: show users
Step 3 and 2 works , how can i send this in one single command (mgconsole in non-interactive mode)
I can do this
show users ;
root@90bdd537ae1a:/usr/lib/memgraph# mgconsole --username=username --password=password < test.txt
| user |
| “user” |
(Write what you thought would happen.)
(Write what happened. Add full console log messages and screenshots, if applicable.)
- Memgraph version used
- Operating system and version (e.g., Ubuntu 20.04.2 LTS)
Hi @sgupops, you should be able to do this. We maybe didn’t document that properly.
For the setup, I have executed:
CREATE USER foo;
SET PASSWORD FOR foo to "bar";
My test.txt file has the following command:
mgconsole --username=foo --password=bar < test.txt
Not sure what issue you are getting, can you add more details on what did you get on output?
Yes this works fine, but I am looking to pass as an argument in mgconsole, So i can avoid creating files for simple commands.
Ok @sgupops , I understand now, this is currently not supported. I have open the issue for this. You can track the progress here: Enable to execute single query without entering into interactive mode · Issue #48 · memgraph/mgconsole · GitHub
It’s also possible to do the following:
echo "MATCH (n) RETURN n;" | mgconsole
cat file.cypherl | mgconsole --username=foo --password=bar
A ok pipes work, we should probably document this a bit better.