DEV Community

Ajeeb.K.P
Ajeeb.K.P

Posted on

How to install mycli for root

Intro

You might be using following command as a workaround in your local environment for avoiding setting a mysql password

sudo mysql

But, what if you want to use mycli.

Note: if you just use sudo pip install <some_package_name> This might break the system, as python dependencies of the system may get affected.

How to enable mycli

Switch to root account
sudo su

Create a virtualenv in root user's home folder (or where ever you like :-) )
python -m venv /root/venv

Add this venv to load by default in root account.

vim ~/.bashrc

# Add this conent
. /root/venv/bin/activate

Now you can use

sudo mycli

Note

Just use pip install command to install similar tools like pgcli too samve venv (ie. /root/venv). But, pgcli doesn't support this root login, as far I know.

pip install pgcli

Links

https://github.com/dbcli
https://www.dbcli.com/

Top comments (0)