ERROR 1045 (28000): Access denied for user 'root'@'10.0.1.14'

by XDK 23. August 2019 21:24

Explanation:

The mention exception occurred while granting privileges to the MySQL instance database.

Exception:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.0.1.14';
ERROR 1045 (28000): Access denied for user 'root'@'10.0.1.14' (using password: YES)

Solution:

Login to the data tier where MYSQL server --> Login to MYSQL --> Execute the following steps.

        ubuntu@ip-10-0-2-227:~$ sudo mysql -u root -p

        mysql> select current_user();
        +----------------+
        | current_user() |
        +----------------+
        | root@localhost |
        +----------------+
        1 row in set (0.00 sec)

        mysql> SELECT host,user,Grant_priv,Super_priv FROM mysql.user where user = 'root';
        +-----------+------+------------+------------+
        | host | user | Grant_priv | Super_priv |
        +-----------+------+------------+------------+
        | localhost | root | Y | Y |
        | 10.0.1.14 | root | N | Y |
        +-----------+------+------------+------------+
        2 rows in set (0.00 sec)

        mysql> UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
        Query OK, 1 row affected (0.00 sec)
        Rows matched: 2 Changed: 1 Warnings: 0

        mysql> SELECT host,user,Grant_priv,Super_priv FROM mysql.user where user = 'root';
        +-----------+------+------------+------------+
        | host | user | Grant_priv | Super_priv |
        +-----------+------+------------+------------+
        | localhost | root | Y | Y |
        | 10.0.1.14 | root | Y | Y |
        +-----------+------+------------+------------+
        2 rows in set (0.00 sec)

        mysql> FLUSH PRIVILEGES;
        Query OK, 0 rows affected (0.00 sec)

  • Try again

        mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.0.1.14';

 

Tags:

MySQL

ERROR 1130 (HY000): Host '10.0.1.14' is not allowed to connect to this MySQL server

by XDK 23. August 2019 20:59

Explanation:

The mention exception occurred while connecting to MySQL database instance remotely.

Exception:

ubuntu@ip-10-0-1-14:~$ sudo mysql -u root -p -h 10.0.2.227
Enter password:
ERROR 1130 (HY000): Host '10.0.1.14' is not allowed to connect to this MySQL server

Solution:

Login to the data tier where MYSQL server --> Login to MYSQL --> Execute the following steps.

        ubuntu@ip-10-0-2-227:~$ sudo mysql -u root -p

        mysql> SELECT host FROM mysql.user WHERE User = 'root';
        +-----------+
        | host |
        +-----------+
        | localhost |
        +-----------+
        1 row in set (0.00 sec)

        mysql> CREATE USER 'root'@'10.0.1.14' IDENTIFIED BY '*****';
        Query OK, 0 rows affected (0.00 sec)

        mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.0.1.14';
        Query OK, 0 rows affected (0.00 sec)

        mysql> FLUSH PRIVILEGES;
        Query OK, 0 rows affected (0.00 sec)

        mysql> SELECT host FROM mysql.user WHERE User = 'root';
        +-----------+
        | host |
        +-----------+
        | 10.0.1.14 |
        | localhost |
        +-----------+
        2 rows in set (0.00 sec)

  • Try again

         ubuntu@ip-10-0-1-14:~$ sudo mysql -u root -p -h 10.0.2.227

Tags:

MySQL

ERROR 2003 (HY000): Can't connect to MySQL server on '10.0.2.227' (111)

by XDK 23. August 2019 20:31

Explanation:

The mention exception occurred while connecting to MySQL database instance remotely.

Exception:

ubuntu@ip-10-0-1-14:~$ sudo mysql -u root -p -h 10.0.2.227
Enter password:
ERROR 2003 (HY000): Can't connect to MySQL server on '10.0.2.227' (111)

Solution:

Login to the data tier where MYSQL server --> Login to MYSQL --> Execute the following steps.

  • Comment the bind-address       

        ubuntu@ip-10-0-2-227:~$ sudo mysql -u root -p
        ubuntu@ip-10-0-2-227:~$ more /etc/mysql/mysql.cnf

        !includedir /etc/mysql/conf.d/
        !includedir /etc/mysql/mysql.conf.d/

        Note: Search for bind-address = 127.0.0.1. in /etc/mysql/mysql.cnf. If not found, search for bind-address = 127.0.0.1 in the files under included directories(!includedir).

        ubuntu@ip-10-0-2-227:~$ sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

        Comment the bind-address as follows
        # bind-address = 127.0.0.1

        Save the /etc/mysql/mysql.conf.d/mysqld.cnf file

  • Restart mysql to load the recent configuration

        ubuntu@ip-10-0-2-227:~$ sudo systemctl restart mysql
        ubuntu@ip-10-0-2-227:~$ sudo systemctl status mysql
        ● mysql.service - MySQL Community Server
         Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
        Active: active (running) since Wed 2019-08-21 18:31:49 UTC; 13s ago
        Process: 15835 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/m
        Process: 15813 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exi
        Main PID: 15837 (mysqld)
        Tasks: 27 (limit: 1152)
        CGroup: /system.slice/mysql.service
        ─15837 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pi

  • Try again

         ubuntu@ip-10-0-1-14:~$ sudo mysql -u root -p -h 10.0.2.227

Tags:

MySQL

What are LAMP, WAMP, MAMP and WISA stacks?

by XDK 20. August 2019 22:59

Explanation:

The LAMP stack is the foundation for Linux hosted websites is the Linux, Apache, MySQL and PHP (LAMP) software stack.
The WAMP stack is the foundation for Windows hosted websites is the Windows, Apache, MySQL and PHP (WAMP) software stack.
The MAMP stack is the foundation for MacOS hosted websites is the MacOS, Apache, MySQL and PHP (MAMP) software stack.
The WISA stack is the foundation for Windows hosted websites is the Windows, IIS, MySQL and ASP.net (WISA) software stack.

The Layers of a Stack:
OS based web servers consist of four software components. These components, arranged in layers supporting one another, make up the software stack. Websites and Web Applications run on top of this underlying stack. The common software components that make up a traditional LAMP, WAMP, MAMP and WISA stack are:

OS (Linux\Windows\MacOS): The operating system (OS) makes up our first layer. OS sets the foundation for the stack model. All other layers run on top of this layer.

Apache: The second layer consists of web server software, which is Apache Web Server. This layer resides on top of the Linux layer. Web servers are responsible for translating from web browsers to their correct website.

Internet Information Service (IIS): The second layer consists of web server software, which is IIS. IIS is a manageable, secure and flexible service that is crucial for web hosting anything on the web. One can enable IIS on the computer operating on Windows 10.

MySQL: Our third layer is where databases live. MySQL stores details that can be queried by scripting to construct a website. MySQL usually sits on top of the Linux layer alongside Apache/layer 2. In high end configurations, MySQL can be off loaded to a separate host server.

PHP: Sitting on top of them all is our fourth and final layer. The scripting layer consists of PHP and/or other similar web programming languages. Websites and Web Applications run within this layer.

Tags:

Amazon Web Service | Azure Native DevOps | General | Microsoft Azure Services

How to install and configure the CloudWatch logs agent on a EC2 Ubuntu linux server instance?

by XDK 16. August 2019 20:58

Steps:

 1. Create and Attach an IAM role with "CloudWatchFullAccess" policy to the EC2 instance as follows

  • Open the IAM console --> Create Role --> apply.
  • Attach the created Role to the EC2 instance.

2. To install and configure CloudWatch Logs on an existing Ubuntu Server instance

  • Connect to the EC2 instance,
  • On EC2 instance, run the following commands before installing CloudWatch Log

         sudo apt update
         sudo apt install python3

  • To install and configure CloudWatch Logs directly from the internet

         curl https://s3.amazonaws.com/aws-cloudwatch/downloads/latest/awslogs-agent-setup.py -O

  • Run the following command to setup system and custom application logs

        sudo python ./awslogs-agent-setup.py --region us-east-1