Wednesday, 25 May 2016

MySql database administration in Linux

  • How to set MySQL Root password?
                 #mysqladmin -u root password YOURNEWPASSWORD
  • How to Change MySQL Root password?
                 #mysqladmin -u root -p oldpassword password 'newpassword'
 
  • How to check MySQL Server is running?
               # mysqladmin -u root -p ping
                 Enter password:
                 mysqld is alive

  • How to Check which MySQL version
               # mysqladmin -u root -p version

  • How to Find current Status of MySQL server?
               # mysqladmin -u root -ptmppassword status

  • How to check & see MySQL Server Variable’s and value’s?
               # mysqladmin -u root -p extended-status
               #mysqladmin  -u root -p variables

  • How to check all the running Process of MySQL server?
              # mysqladmin -u root -p processlist

  • How to create a Database?
               # mysqladmin -u root -p create databasename

  • How to delete a Database?
               # mysqladmin -u root -p drop databasename

  • How to reload/refresh MySQL Privileges?
               # mysqladmin -u root -p reload;
               # mysqladmin -u root -p refresh

  • How to shutdown MySQL server Safely?
               #mysqladmin -u root -p shutdown

MySQL Flush commands
  • flush-hosts: Flush all host information from host cache.
               # mysqladmin -u root -p flush-hosts

  • flush-tables: Flush all tables.
                # mysqladmin -u root -p flush-tables

  • flush-threads: Flush all threads cache.
                # mysqladmin -u root -p flush-threads

  • flush-logs: Flush all information logs.
                # mysqladmin -u root -p flush-logs

  • flush-privileges: Reload the grant tables (same as reload).
                # mysqladmin -u root -p flush-privileges

  • flush-status: Clear status variables.
                # mysqladmin -u root -p flush-status

  • How to Connect remote mysql server
                # mysqladmin  -h 172.16.25.126 -u root –p

  • How to store MySQL server Debug Information to logs?
                # mysqladmin  -u root -p debug

2 comments: