Dons Deals

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, 2 December 2012

MySQL Commands for the Linux Command Line for Database Administration in Linux

Posted on 02:45 by Unknown
In the past, I looked and looked for a quick list and how to on MySQL Commands for the Command Line in Linux and found nothing but long Manuals to read through. This is just what I've been looking for. Check it out...

Don

20 MySQL (Mysqladmin) Commands for Database Administration in Linux

Written By Ravi Saive in: CentOS, Fedora, Linux Commands, Linux Distros, RedHat, Ubuntu

mysqladmin is a command-line utility the comes with MySQL server and it is used by Database Administrators to perform some basic MySQL tasks easily such as setting root password, changing root password, monitoring mysql processes, reloading privileges, checking server status etc.

In this article we’ve compiled some very useful ‘mysqladmin‘ commands that are used by system/database administrators in their day-to-day work. You must have MySQL server installed on your system to perform these tasks.

20 mysqladmin commands examples

If you don’t have MySQL server installed or you are using older version of MySQL server, then we recommend you all to install or update your version by following our below article.

  1. Installation of MySQL 5.5.28 Server on RHEL/CentOS/Fedora

1. How to set MySQL Root password?

If you have fresh installation of MySQL server, then it doesn’t required any password to connect it as root user. To set MySQL password for root user, use the following command.

# mysqladmin -u root password YOURNEWPASSWORD

2. How to Change MySQL Root password?

If you would like to change or update MySQL root password, then you need to type the following command. For example, say your old password is 123456 and you want to change it with new password say xyz123.

mysqladmin -u root -p123456 password 'xyz123'

3. How to check MySQL Server is running?

To find out whether MySQL server is up and running, use the following command.

# mysqladmin -u root -p ping    Enter password:  mysqld is alive

4. How to Check which MySQL version I am running?

The following command shows MySQL version along with the current running status .

# mysqladmin -u root -p version    Enter password:  mysqladmin  Ver 8.42 Distrib 5.5.28, for Linux on i686  Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.    Oracle is a registered trademark of Oracle Corporation and/or its  affiliates. Other names may be trademarks of their respective  owners.    Server version          5.5.28  Protocol version        10  Connection              Localhost via UNIX socket  UNIX socket             /var/lib/mysql/mysql.sock  Uptime:                 7 days 14 min 45 sec    Threads: 2  Questions: 36002  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8  Queries per second avg: 0.059

4. How to Find out current Status of MySQL server?

To find out current status of MySQL server, use the following command. The mysqladmin command shows the status of uptime with running threads and queries.

# mysqladmin -u root -ptmppassword status    Enter password:  Uptime: 606704  Threads: 2  Questions: 36003  Slow queries: 0  Opens: 15  Flush tables: 1  Open tables: 8  Queries per second avg: 0.059

6. How to check status of all MySQL Server Variable’s and value’s?

To check all the running status of MySQL server variables and values, type the following command. The output would be similar to below.

# mysqladmin -u root -p extended-status    Enter password:  +------------------------------------------+-------------+  | Variable_name                            | Value       |  +------------------------------------------+-------------+  | Aborted_clients                          | 3           |  | Aborted_connects                         | 3           |  | Binlog_cache_disk_use                    | 0           |  | Binlog_cache_use                         | 0           |  | Binlog_stmt_cache_disk_use               | 0           |  | Binlog_stmt_cache_use                    | 0           |  | Bytes_received                           | 6400357     |  | Bytes_sent                               | 2610105     |  | Com_admin_commands                       | 3           |  | Com_assign_to_keycache                   | 0           |  | Com_alter_db                             | 0           |  | Com_alter_db_upgrade                     | 0           |  | Com_alter_event                          | 0           |  | Com_alter_function                       | 0           |  | Com_alter_procedure                      | 0           |  | Com_alter_server                         | 0           |  | Com_alter_table                          | 0           |  | Com_alter_tablespace                     | 0           |  +------------------------------------------+-------------+

7. How to see all MySQL server Variables and Values?

To see all the running variables and values of MySQL server, use the command as follows.

# mysqladmin  -u root -p variables    Enter password:  +---------------------------------------------------+----------------------------------------------+  | Variable_name                                     | Value                                        |  +---------------------------------------------------+----------------------------------------------+  | auto_increment_increment                          | 1                                            |  | auto_increment_offset                             | 1                                            |  | autocommit                                        | ON                                           |  | automatic_sp_privileges                           | ON                                           |  | back_log                                          | 50                                           |  | basedir                                           | /usr                                         |  | big_tables                                        | OFF                                          |  | binlog_cache_size                                 | 32768                                        |  | binlog_direct_non_transactional_updates           | OFF                                          |  | binlog_format                                     | STATEMENT                                    |  | binlog_stmt_cache_size                            | 32768                                        |  | bulk_insert_buffer_size                           | 8388608                                      |  | character_set_client                              | latin1                                       |  | character_set_connection                          | latin1                                       |  | character_set_database                            | latin1                                       |  | character_set_filesystem                          | binary                                       |  | character_set_results                             | latin1                                       |  | character_set_server                              | latin1                                       |  | character_set_system                              | utf8                                         |  | character_sets_dir                                | /usr/share/mysql/charsets/                   |  | collation_connection                              | latin1_swedish_ci                            |  +---------------------------------------------------+----------------------------------------------+

8. How to check all the running Process of MySQL server?

The following command will display all the running process of MySQL database queries.

# mysqladmin -u root -p processlist    Enter password:  +-------+---------+-----------------+---------+---------+------+-------+------------------+  | Id    | User    | Host            | db      | Command | Time | State | Info             |  +-------+---------+-----------------+---------+---------+------+-------+------------------+  | 18001 | rsyslog | localhost:38307 | rsyslog | Sleep   | 5590 |       |                  |  | 18020 | root    | localhost       |         | Query   | 0    |       | show processlist |  +-------+---------+-----------------+---------+---------+------+-------+------------------+

9. How to create a Database in MySQL server?

To create a new database in MySQL server, use the command as shown below.

# mysqladmin -u root -p create databasename    Enter password:
# mysql -u root -p    Enter password:  Welcome to the MySQL monitor.  Commands end with ; or \g.  Your MySQL connection id is 18027  Server version: 5.5.28 MySQL Community Server (GPL) by Remi    Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.    Oracle is a registered trademark of Oracle Corporation and/or its  affiliates. Other names may be trademarks of their respective  owners.    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.    mysql> show databases;  +--------------------+  | Database           |  +--------------------+  | information_schema |  | databasename       |  | mysql              |  | test               |  +--------------------+  8 rows in set (0.01 sec)    mysql>

10. How to drop a Database in MySQL server?

To drop a Database in MySQL server, use the following command. You will be asked to confirm press ‘y‘.

# mysqladmin -u root -p drop databasename    Enter password:  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 'databasename' database [y/N] y  Database "databasename" dropped

11. How to reload/refresh MySQL Privileges?

Read More...
http://www.tecmint.com/mysqladmin-commands-for-database-administration-in-linux/

  • Popular
  • Latest
  • Install WordPress 3.4.2 Using LAMP or LEMP on RHEL, CentOS & Fedora16 Comments
  • Install Apache, MySQL 5.5.28 & PHP 5.4.9 on RHEL/CentOS 6.3/5.6 & Fedora 17-1212 Comments
  • CentOS 6.3 Step by Step Installation Guide with Screenshots9 Comments
  • Install mod_pagespeed (Website Optimizer) for Apache in RHEL, CentOS and Fedora8 Comments
  • Install Apache OpenOffice 3.4.1 on RHEL/CentOS 6.3/5.8 and Fedora 17/16

News 12-01-12
Five free social networking tools for the desktop | TechRepublic
10 ways automated tools can help you meet the tech challenges of 2013 | TechRepublic
Austin Restaurant Features SI Black Diamond Venue
Why voice recognition will finally conquer the office - Computerworld
iGoogle
Linux Today - How To Upgrade From Linux Mint 13 (Maya) To 14 (Nadia) With apt
How To Upgrade From Linux Mint 13 (Maya) To 14 (Nadia) With apt | HowtoForge - Linux Howtos and Tutorials
Linux Today - Open Source CRM Zurmo Releases Version 0.8.0, Email and Theming Added
Open Source CRM Zurmo Releases Version 0.8.0, Email and Theming Added - SFGate
The War on Oil – Part 1 | Iranian.com
St. Optimus of Prime
Minecraft clock radio puts a creeper head next to your bed
Open source capactive charger resurrects an electric skateboard
Google snaps up Waterloo startup BufferBox | FP Tech Desk | Financial Post
How to Enable or Disable Location Sensing in Windows 7 and 8
How to Control Your Dreams: 9 steps - wikiHow
David Stern Fines Spurs for Day Off, Raising Question for All Bosses - NYTimes.com
Doctors Who Work for Hospitals Face a New Bottom Line - NYTimes.com
More Sleep May Help Some People Feel Less Pain
Troubled Firm Stops Making Generic Lipitor Pending Investigation
Do Older Adults Need Vitamins, Supplements?
Linux Today - 20 Best Android apps this week
20 Best Android apps this week | Technology | guardian.co.uk
News 12-01-12 #2
Ford Issues Urgent Voluntary Recall for 1.6-liter Escape, Fusion Models - WOT on Motor Trend
Linux Today - 20 MySQL (Mysqladmin) Commands for Database Administration in Linux
20 MySQL (Mysqladmin) Commands for Database Administration in Linux
Linux Today - Conditions in bash scripting (if statements)
Conditions in bash scripting (if statements) | Pinehead.tv
Recording audio with Chrome using HTML5
Plan 9 on the Raspberry Pi
Raspberry Pi Quadcopter
Dividing the West Bank, Deepening a Rift - NYTimes.com
Raspberry Pi powered quadrocopter - YouTube
Getting Plan 9 running on the Raspberry Pi | The Bendyworks Blog | Bendyworks | Ruby on Rails, iOS, & Clojure Consultants | Madison, WI
64 Rasberry Pis turned into a supercomputer
Christine Jorgensen - Wikipedia, the free encyclopedia
How to record audio in Chrome with native HTML5 APIs
Accelerometer-based game control using an iOS device courtesy of HTML5

Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • ZigBee - a specification for a suite of high level communication protocols used to create personal area networks built from small low-power digital radios
    ZigBee From Wikipedia, the free encyclopedia Jump to: navigation , search ZigBee ...
  • Open Sorce Hardware - The Wandboard is a low cost board based on the i.MX6 multicore ARM Cortex-A9 family of processors. In consists of a core module based on the EDM standard and a simple to extend baseboard
    Here's an Open Source Wandboard - Freescale i.MX6 ARM Cortex-A9 Opensource Community Development Board. The Wandboard is a low ...
  • 1967 Chevy Camaro Complete Rebuild - Videos, HowStuffWorks Videos "NAPA Videos"
    Video Playlist - West Coast Customs Shop, Completely Tears Down a 1967 Chevy Camaro and then does a Complete Rebuild...
  • Installing and Updating GRUB 2 in Fedora Linux
    This Page has allot of info on Installing, Updating and Trouble Shooting Grub 2 in Fedora Linux. There are some good How To's for...
  • Open source PLC's - PLC (programmable logic controller)
    Here's some Great Looking Open source PLC Projects. The OSPLC Small & Large Bricks are open-source PLC (programmable logic ...
  • Dynaco Stereo 400 Power Amplifier - Dead Channel Fix - Dynaco Repairs For PC-28 Amplifier Boards
    My Dynaco Stereo 400 Amp... The Page Below these e-mails with Kevin Boales. Looks like the one that I found. Back in ...
  • Fly Geyser is located on the private Fly Ranch and is accessible only by a small private dirt road in Washoe County Nevada
    I found some beautiful Photographs of this Place in Nevada. It's called " Fly Geyser , also known as Fly Ranch ...
  • Grid Compass Computer - Pioneering the Laptop
    1986-GRiD Gridcase 1520 laptop Video Link... http://www.youtube.com/watch?v=nF_VWBBE0M8&feature=related Pione...
  • Running a PXE Boot Server in Parted Magic
    Here's some good info on Running PXE Boot Server in Parted Magic... Don PXE – Parted Magic PXE PXE: the "classic" way ...
  • How To Clean or Replace The (potentiometer or "pot") Controls On Your Guitar Amplifier
    How To Clean The Controls On Your Amplifier 3 Author: Teslaphonics ...

Blog Archive

  • ►  2013 (354)
    • ►  December (12)
    • ►  November (33)
    • ►  October (23)
    • ►  September (46)
    • ►  August (52)
    • ►  July (36)
    • ►  June (45)
    • ►  May (17)
    • ►  April (38)
    • ►  March (19)
    • ►  February (22)
    • ►  January (11)
  • ▼  2012 (145)
    • ▼  December (27)
      • Secure Boot Bootloader for Linux Distributions Ava...
      • To fix or not to fix - EEVblog - Lecroy 9384C Osci...
      • How to Clean a Coffee Maker - 8 steps from WikiHow
      • AjaXplorer File Sharing for Web and Local Network ...
      • Merry Christmas to all...
      • Viktor's DIY: Lil Bang (Sound Trigger for Cameras)
      • Viktor's DIY: Zeus: trigger your camera with light...
      • Viktor's DIY - Solid State Relay Switched Mains Rig
      • Open-source alternatives to Instagram Picture Apps...
      • PCB Fab Tutorial - Comprehensive Guide to Home PCB...
      • An Open Hardware Laptop - Building my Own Laptop b...
      • Apache Mahout - Scalable machine learning and data...
      • Beautiful Custom Made Hickory Wood Computer Desk!
      • Monitoring your server with tmux - Linux User
      • Bird Buggy - Parrot driven autonomous Buggy
      • Ekiga Open Source Softphone like Skype - Ekiga 4.0...
      • OpenDisc is a Collection of Free and Open Source S...
      • VALO-CD.net - Free and Open Source Apps CD ISO Image
      • The New TI XMS430FR5969IRGZR - MSP430 Ultra-Low Po...
      • BeagleBone Intro - info and video on the Beagleboa...
      • I received my free sample of the, XMS430FR5969IRGZ...
      • MSP430 bit banged USB 1.1 by Mecrisp - Native code...
      • New features in Linux Mint 14 Nadia - With Mate an...
      • 3D Printing Objects in Homes and Small Shops - Lin...
      • MySQL Commands for the Linux Command Line for Data...
      • And Now, for Something Completely Different - Plan...
      • Line 6 Soundscape M20 Digital Mixer and Stagescape...
    • ►  November (31)
    • ►  October (14)
    • ►  September (15)
    • ►  August (48)
    • ►  July (10)
Powered by Blogger.

About Me

Unknown
View my complete profile