1. 程式人生 > 實用技巧 >MySQL客戶端mysqladmin命令

MySQL客戶端mysqladmin命令

1)設定密碼

#1.設定密碼
[root@db02 ~]# mysqladmin -uroot password
New password: 
Confirm new password:

#2.修改密碼
[root@db02 ~]# mysqladmin -uroot -p password
Enter password: 
New password: 
Confirm new password:

2)關閉服務

[root@db02 ~]# mysqladmin -uroot -p shutdown 
Enter password: 123

3)庫外建庫

[root@db02 ~]# mysqladmin -uroot -p123 create database222222

4)庫外刪庫

[root@db02 ~]# mysqladmin -uroot -p123 drop database222222
Warning: Using a password on the command line interface can be insecure.
Dropping the database is potentially a very bad thing to do.
Any data stored in the database will be destroyed.

Do you really want to drop the 'database222222
' database [y/N] y Database "database222222" dropped

5)檢視資料庫配置

[root@db02 ~]# mysqladmin -uroot -p123 variables | grep -w server_id

6)檢測資料庫是否啟動

[root@db02 ~]# mysqladmin -uroot -p ping
Enter password: 
mysqld is alive

7)檢視資料庫資訊

[root@db02 ~]# mysqladmin -uroot -p123 status
Warning: Using a password on the command line 
interface can be insecure. Uptime: 130 Threads: 1 Questions: 94 Slow queries: 0 Opens: 70 Flush tables: 1 Open tables: 63 Queries per second avg: 0.723 Slow queries: 0 Queries per second avg: 0.723

8)重新整理授權表

[root@db02 ~]# mysqladmin -uroot -p123 reload