Home  >  Article  >  Database  >  Code sharing of daily management commands of mysqladmin under mysql

Code sharing of daily management commands of mysqladmin under mysql

黄舟
黄舟Original
2017-03-24 13:31:051353browse

The editor below will bring you a summary of the daily management commands of mysqladmin under mysql (a must-read article). The editor thinks it is quite good, so I will share it with you now and give it as a reference for everyone. Let’s follow the editor and take a look.

Mysqladmin tool usage format:

mysqladmin [option] command [command option] command ......

Parameter options:

-c number Statistics of automatic running times, must be used together with -i
-i number How long is the interval between repeated executions

0) Each two Check the status of the server once every second, repeating 5 times in total.

[root@test-huanqiu ~]# mysqladmin -uroot -p -i 2 -c 5 status

1) Check the status of the server: status

[root@test-huanqiu ~]# mysqladmin -uroot -p status

2) Modify the root password:

[root@test-huanqiu ~]# mysqladmin -u root -p原密码 password 'newpassword'

3) Check whether mysqlserver is available:

[root@test-huanqiu ~]# mysqladmin -uroot -p ping

4) Query Server version

[root@test-huanqiu ~]# mysqladmin -uroot -p version

5) View the current value of the server status:

[root@test-huanqiu ~]# mysqladmin -uroot -p extended-status

6) Query the server System variables Value:

[root@test-huanqiu ~]# mysqladmin -uroot -p variables

7) Display all running processes on the server:

[root@test-huanqiu ~]# mysqladmin -uroot -p process
list
[root@test-huanqiu ~]# mysqladmin -uroot -p-i 1 processlist       
 //每秒刷新一次


8)Create database

[root@test-huanqiu ~]# mysqladmin -uroot -p create daba-test

9)Display all databases on the server

[root@test-huanqiu ~]# mysqlshow -uroot -p

10) Display the tables under the database daba-test:

[root@test-huanqiu ~]# mysqlshow -uroot -p daba-test

11) Statistics of the summary of database table columns under daba-test

[root@test-huanqiu ~]# mysqlshow -uroot -p daba-test -v

12) Statistics of the number of columns and rows of the database table under daba-test

[root@test-huanqiu ~]# mysqlshow -uroot -p daba-test -v -v

13) Delete database daba-test

[root@test-huanqiu ~]# mysqladmin -uroot -p drop daba-test

14)ReloadPermission information

[root@test-huanqiu ~]# mysqladmin -uroot -p reload

15) Refresh all tablescache, and close and open log

[root@test-huanqiu ~]# mysqladmin -uroot -p refresh

16) Use safe modeClose the database

[root@test-huanqiu ~]# mysqladmin -uroot -p shutdown

17) Refresh commands mysqladmin flush commands

[root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-hosts
[root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-logs
[root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-privileges
[root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-status
[root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-tables
[root@test-huanqiu ~]# mysqladmin -u root -ptmppassword flush-threads

18) mysqladmin executes the kill process :

[root@test-huanqiu ~]# mysqladmin -uroot -p processlist
[root@test-huanqiu ~]# mysqladmin -uroot -p kill idnum

19) Stop and start MySQL replication on a slave server

[root@test-huanqiu ~]# mysqladmin -u root -p s
top
-slave
[root@test-huanqiu ~]# mysqladmin -u root -p start-slave

20) Execute multiple at the same time Command

[root@test-huanqiu ~]# mysqladmin -u root -p process status version

The above is the detailed content of Code sharing of daily management commands of mysqladmin under mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn