MySQLAdmin digunakan untuk melakukan konfigurasi pada MySQL Server. Bagi yang ingin belajar menggunakan database ini, ada beberapa perintah yang biasa digunakan dalam MySQL.
Kita asumsikan bahwa password lama yang kita gunakan adalah “123456”, dan password baru adalah “654321” tanpa tanda kutip.
# mysqladmin -u root –p123456 password 654321
Untuk menguji perubahan yang terjadi, silahkan ketik perintah dibawah ini :
# mysql -u root -p654321
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.25-rc-community MySQL Community Server (GPL)
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>
# mysqladmin -u root -p ping Enter password: mysqld is alive
# mysqladmin -u root -p654321 version
Hasil jika menggunakan Linux : mysqladmin Ver 8.42 Distrib 5.1.25-rc, for redhat-linux-gnu on i686 Copyright (C) 2000-2006 MySQL AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Server version 5.1.25-rc-community Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime: 107 days 6 hours 11 min 44 sec Threads: 1 Questions: 231976 Slow queries: 0 Opens: 17067 Flush tables: 1 Open tables: 64 Queries per second avg: 0.25
Hasil jika menggunakan Windows :
mysqladmin Ver 8.41 Distrib 5.0.22, for Win32 on ia32 Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Server version 5.0.22-community-nt-log Protocol version 10 Connection localhost via TCP/IP TCP port 3306 Uptime: 3 hours 7 min 10 sec Threads: 1 Questions: 94 Slow queries: 0 Opens: 0
Flush tables: 1 Open tables: 1 Queries per second avg: 0.008
# mysqladmin -u root -p654321 status Uptime: 11680 Threads: 1 Questions: 231977 Slow queries: 0 Opens: 17067 Flush tables: 1 Open tables: 64 Queries per second avg: 0.25
Keterangan :
# mysqladmin -u root -p654321 extended-status +-----------------------------------+-----------+ | Variable_name | Value | +-----------------------------------+-----------+ | Aborted_clients | 579 | | Aborted_connects | 8 | | Binlog_cache_disk_use | 0 | | Binlog_cache_use | 0 | | Bytes_received | 41387238 | | Bytes_sent | 308401407 | | Com_admin_commands | 3524 | | Com_assign_to_keycache | 0 | | Com_alter_db | 0 | | Com_alter_db_upgrade | 0 |
# mysqladmin -u root -p654321 variables +---------------------------------+---------------------------------+ | Variable_name | Value | +---------------------------------+---------------------------------+ | auto_increment_increment | 1 | | basedir | / | | big_tables | OFF | | binlog_format | MIXED | | bulk_insert_buffer_size | 8388608 | | character_set_client | latin1 | | character_set_database | latin1 | | character_set_filesystem | binary | skip..... | wait_timeout | 28800 | +---------------------------------+---------------------------------+
# mysqladmin -u root -p654321 create belajardb # mysql -u root -p654321 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 705 Server version: 5.1.25-rc-community MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | wordpress | | belajardb | +--------------------+ 4 rows in set (0.00 sec)
# mysqladmin -u root -p654321 drop belajardb 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 'belajardb' database [y/N] y Database “belajardb” dropped # mysql -u root -p654321 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 707 Server version: 5.1.25-rc-community MySQL Community Server (GPL) Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | wordpress | +--------------------+ 3 rows in set (0.00 sec)
# mysqladmin -u root -p654321 reload
# mysqladmin -u root -p654321 refresh
# mysqladmin -u root -p654321 shutdown # mysql -u root -p654321 ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
NB : Untuk menjalankannya kembali kita tinggal mengetikkan perintah :
Bagi pengguna Linux : /etc/rc.d/init.d/mysql start
Bagi pengguna Windows : X:\MySQL\bin\mysql-nt
Didalam menjalankan perintah pada mysqladmin, kita juga dapat menggabungkan beberapa perintah dijalan sekaligus. Umpamanya untuk melihat versi dan juga status dari MySQL Server.
# mysqladmin -u root -p654321 status version Hasil yang ditampilkan akan terlihat seperti dibawah ini :
Uptime: 3135 Threads: 1 Questions: 80 Slow queries: 0 Opens: 15 Flush tables: 3 Open tables: 0 Queries per second avg: 0.25 mysqladmin Ver 8.42 Distrib 5.1.25-rc, for redhat-linux-gnu on i686 Copyright (C) 2000-2006 MySQL AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Server version 5.1.25-rc-community Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock Uptime: 52 min 15 sec
Contoh perintah diatas juga bisa disingkat menjadi seperti dibawah ini :
# mysqladmin -u root -p654321 pro stat ver
Gunakan opsi -h, untuk koneksi melalui remote ke MySQL server dan langsung menjalankan beberapa perintah mysqladmin.
# mysqladmin -h 192.168.1.1 -u root -p654321 pro stat ver
Copyright © 2013 Hot Topix Theme. Theme by MVP Themes, powered by Wordpress.
2 Comments