biomed
biomed

Reputation: 647

command line mysql database administration tool

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

Upvotes: 2

Views: 1262

Answers (6)

greg0ire
greg0ire

Reputation: 23265

Just use the mysql client (UNIX command mysql).

Upvotes: 0

biomed
biomed

Reputation: 647

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;

Upvotes: 0

Donald
Donald

Reputation: 1738

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

Upvotes: 3

astropanic
astropanic

Reputation: 10939

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

Upvotes: 2

Ben S
Ben S

Reputation: 69412

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

Upvotes: 3

oezi
oezi

Reputation: 51817

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

Upvotes: 1

Related Questions