Sunday 19 May 2013

MySQL Basic Commands for DBA


MySQL Basic Commands for DBA

Linux command

*      Check Disk Space usage:-
Command: - df –h

*      Check memory usage:-
Command: - free –m

*      Check OS Version:-
Command: - Cat /etc/redhat-release
Command: - uname –a                  ------------------ (For architectural info .i.e. 32 or 64 bit)

*      Check MySQL Version:-
Command: - mysql –V

*      MySQL Configuration file:-
/etc/my.cnf

*      MySQL error Log file:-
/var/log/mysql.log

*      MySQL data directory
/var/lib/mysql



MySQL Basic Understanding & Command
MySQL, the most popular Open Source SQL database management system, is developed, distributed, and supported by Oracle Corporation.  The MySQL Web site (http://www.mysql.com/) provides the latest information about MySQL software.
Refer below official link for more detail on below topics.
http://dev.mysql.com/doc/refman/5.5/en/what-is-mysql.html

*      MySQL databases are relational
*      MySQL software is Open Source
*      The MySQL Database Server is very fast, reliable, scalable, and easy to use
*      MySQL Server works in client/server or embedded systems
*      A large amount of contributed MySQL software is available

Basic MySQL Commands:-
*      To check the databases:-
        mysql>show databases;
        +--------------------+
        | Database           |
        +--------------------+
        | information_schema |
        | mysql              |
        | performance_schema |------- (From 5.5)
        | test               |
        +--------------------+
 
*      To Use a particular database:-
        mysql> use xyz;(“xyz” database name)
 
 
*      Create a database:-
        mysql> create database abcd; (“abcdb” database name)
 
 
*      To check the available tables inside the database:-
  mysql> show tables;---

it will show you all the tables of the particular database.
 
 
*      Create MySQL User:- By giving all privileges by allowing from localhost
mysql> grant all on *.* to 'username'@'localhost' identified 
by ‘pass’;
mysql> Flush privileges;

No comments:

Post a Comment