I was tired of trying to remember all of the various command and steps for relatively simple requests in MySQL, so I wrote a simple bash script for those.
- Clone, download, or use curl to get the script:
curl -O https://raw.githubusercontent.com/jon-heller/mycli/master/mycli
- Make it executable:
chmod +x mycli
- Copy to the bin directory:
sudo cp mycli /usr/local/bin/mycli
mycli [args] <command>
-u [username]
MySQL username
-p [password]
MySQL password
List databases
Create a database and, optionally, a database user with full privileges to that database
Create user and grant privileges
Export a database to a .sql file