2

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

6 Answers 6

3

The mysql command-line tool comes with the MySQL DBMS.

Sign up to request clarification or add additional context in comments.

Comments

3

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

Comments

2
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

Comments

1

all you need to administrate mysql is mysql. start mysql on the command line and type the requests you want/need.

Comments

0

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;

Comments

0

Just use the mysql client (UNIX command mysql).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.