Home > Database > Mysql Tutorial > body text

Code sharing of daily management commands of mysqladmin under mysql

黄舟
Release: 2017-03-24 13:31:05
Original
1396 people have browsed it

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 ......
Copy after login

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
Copy after login

1) Check the status of the server: status

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

2) Modify the root password:

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

3) Check whether mysqlserver is available:

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

4) Query Server version

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

5) View the current value of the server status:

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

6) Query the server System variables Value:

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

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       
 //每秒刷新一次
Copy after login


8)Create database

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

9)Display all databases on the server

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

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

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

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

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

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
Copy after login

13) Delete database daba-test

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

14)ReloadPermission information

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

15) Refresh all tablescache, and close and open log

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

16) Use safe modeClose the database

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

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
Copy after login

18) mysqladmin executes the kill process :

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

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
Copy after login

20) Execute multiple at the same time Command

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

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!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template