linux - Mysql: how to get the mysql status info just using one command -
i have installed mysql-server on ubuntu. if want know status of mysql, need type 'mysql -u root -p' in command line, , need type password enter mysql interaction mode, in interaction mode need type 'show status' , can see info. question is, there method doesn't need enter mysql interaction mode, type 1 command in command line , mysql status info?
you can use:
mysql -p'password' -e "show status"
where -e
flag is:
-e, --execute=name execute command , quit. (disables --force , history file.)
if don't want use password of mysql documentation can store password in option file (note change permissions respectively):
store password in option file. example, on unix, can list password in [client] section of .my.cnf file in home directory:
[client] password=your_pass
so have run:
mysql -e "show status"
Comments
Post a Comment