How to uninstall PHP, Apache and MySQL on ubuntu?

by XDK 26. August 2019 09:48

Explanation:

To uninstall PHP

sudo apt-get remove –purge php*
sudo apt-get purge php*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-php
sudo apt-get dist-upgrade
Note: The output of the below command will provide you with information the installed package software, version, architecture and short description about the package. grep command is used to find the PHP package
sudo dpkg --get-selections | grep php | cut -f 1
sudo apt-get remove --purge <package name from the previous command output>
sudo whereis php
sudo rm -rf <directory/file path from the previous command output>

To uninstall Apache

sudo service apache2 stop
sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
sudo apt-get autoremove
The output of the below command will provide you with information the installed package software, version, architecture and short description about the package. grep command is used to find the MySQL package
sudo dpkg --get-selections | grep apache | cut -f 1
sudo apt-get remove --purge <package name from the previous command output>
sudo whereis apache
sudo rm -rf <directory/file path from the previous command output>

To uninstall MySQL

sudo apt-get remove –purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove.
sudo apt-get autoclean.
sudo apt-get remove dbconfig-php.
sudo apt-get dist-upgrade.
The output of the below command will provide you with information the installed package software, version, architecture and short description about the package. grep command is used to find the MySQL package
sudo dpkg --get-selections | grep mysql | cut -f 1
sudo apt-get remove --purge <package name from the previous command output>
sudo whereis mysql
sudo rm -rf <directory/file path from the previous command output>

Tags:

MySQL | Operating Systems | PHP | Apache

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

About the author

My name is Xavier Dilip Kumar Jayaraj having 16+ years of IT experience which includes solid experience and depth Knowledge in Application Life Cycle Management, Configuration Management, Implementation and Support using TFS on-premises and Azure DevOps. I have invested in gaining DevOps knowledege to expertise with Cloud Computing providers namely Microsoft Azure and Amazon Web Services in recent years. I am very positive to learn and adapt emerging technologies to client’s environment.

Microsoft Certified: Azure Administrator Associate

Microsoft Certified: Azure DevOps Engineer Expert

DevOps Engineer Certificate Program | Transcript 

OTP-AWSD5: AWS IoT: Developing and Deploying an Internet of Things

[PCEP-30-01] PCEP – Certified Entry-Level Python Programmer

Quotes I Like

"Failure will never overtake me if my determination to succeed is strong enough."  - Dr. APJ. Abdul Kalam

"Always be yourself, express yourself, have faith in yourself, do not go out and look for a successful personality and duplicate it." - Bruce Lee

"Technology is just a tool. In terms of getting the kids working together and motivating them, the teacher is the most important." - Bill Gates

"Innovation distinguishes between a leader and a follower." - Steve Jobs

CategoryList

Disclaimer

The information provided here is based on my expreriences, troubleshooting and online/offline findings. It can be used as is on your own risk without any warranties and I impose no rights.