• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • Life always offers you a second chance ... Its called tomorrow !!!

    Friday, May 03, 2013

    Access denied for user 'root'@'localhost' (using password: NO)

    This error pops us mostly while trying to access your MYSQL database

    Resolution:


     [root@server ~]# /etc/init.d/mysqld stop
     Stopping MySQL:                                          [ OK ]

     [root@server ~]# mysqld_safe --skip-grant-tables &
     [1] 24359
     [root@server ~]# Starting mysqld daemon with databases from  /var/lib/mysql

     [root@server ~]# mysql -u root
     Welcome to the MySQL monitor. Commands end with ; or \g.
     Your MySQL connection id is 1
     Server version: 5.0.77 Source distribution
     Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

     mysql> show databases;
     +--------------------+
     | Database |
     +--------------------+
     | information_schema |
     | mysql |
     | openfire |
     +--------------------+
     3 rows in set (0.13 sec)

     mysql> use mysql;
     Reading table information for completion of table and column names
     You can turn off this feature to get a quicker startup with -A
     Database changed

     mysql> show tables;
     +---------------------------+
     | Tables_in_mysql |
     +---------------------------+
     | columns_priv |
     | db |
     | func |
     | help_category |
     | help_keyword |
     | help_relation |
     | help_topic |
     | host |
     | proc |
     | procs_priv |
     | tables_priv |
     | time_zone |
     | time_zone_leap_second |
     | time_zone_name |
     | time_zone_transition |
     | time_zone_transition_type |
     | user |
     +---------------------------+
     17 rows in set (0.00 sec)

     mysql> update user set password=PASSWORD("new_paswd") where User='root';
     Query OK, 3 rows affected (0.05 sec)
     Rows matched: 3 Changed: 3 Warnings: 0

     mysql> flush privileges;
     Query OK, 0 rows affected (0.04 sec)

     mysql> quit
     Bye

     [root@server ~]# /etc/init.d/mysqld restart
     STOPPING server from pid file /var/run/mysqld/mysqld.pid
     102675 04:17:15 mysqld ended
     Stopping MySQL:                                          [ OK ]
     Starting MySQL:                                          [ OK ]
     [1]+ Done mysqld_safe --skip-grant-tables

     root@server ~]# mysql -u root -p 
     Enter password:
     Welcome to the MySQL monitor. Commands end with ; or \g.

     mysql> quit
     Bye

    Follow the below links for more tutorials

    Tutorial for Monitoring Tools SAR and KSAR with examples in Linux
    How to configure Samba 4 Secondary Domain Controller
    How to secure Apache web server in Linux using password (.htaccess)
    How to register Red Hat Linux with RHN (Red Hat Network )
    Red hat Enterprise Linux 5.5 Installation Guide (Screenshots)
    15 tips to enhance security of your Linux machine
    How to set environment (PATH) variable permanently in Linux

    0 comments:

    Post a Comment