Is there a command line script/tool I can use to administer a mysql database. I am in a tightly controlled environment and I can not use tools like phpmyadmin and can only access my database through command line (ssh connection). I can even live with something that can get show table status and describe all tables and write that into a text file. Thanks
all you need to administrate mysql is mysql. start mysql on the command line and type the requests you want/need.
echo "USE database_name; DESCRIBE table_name;" | mysql -u user -p > outfile.txt
You can also enter the password just after the p flag without space, but remember to clear later your command history
Yes, if you install the mysql client, the tool is called mysql.
$ mysql -u root -p
Here's some commands to get you started:
use db_name; // db_name is your db
help show;
show tables;
show columns from tbl_name; // tbl_name is a table in your db
Thanks for the answers. with your help uin the end, the solution that worked for me is to create a .sql files with all the command I needed to get my reports and maintenance. I then used $>tee out.txt; command to log my output to a file and it is working great now. To cancel tee use at mysql command line $>notee;