Remove LAMP

Posted on 2011-03-15
Last Modified: 2013-12-15
How to remove LAMP from Centos5.5?
I have installed it using yum as well as atomic, but I am getting into some problems. I would like to remove everything, but whenever I reinstall MySQL it keeps getting the old root credentials that I don't have.
Question by:MaryBarsoum
  • 7
  • 6
LVL 31

Expert Comment

ID: 35143904
Reinstall it.  When you do, make sure to destroy and remake partitions or at least reformat the partitions.  Then during package selection, do not select Apache, MySQL or whatever you don't want.

Which version of Linux are you using?
LVL 77

Expert Comment

ID: 35143972
stop mysql, look in /var/lib/mysql/mysql which you can rename.
then run the mysql_install_db
The uninstall of mysql does not remove the databases.

Author Comment

ID: 35144511
I am running CentOS 5.5
How can I destroy and remaking the partitions. I am sorry I have little experience in Linux?
Also what is the command for uninstall mysql and how can I delete all the databases from previous versions? Do I write DROP schema; ? How can I delete all the php files and all the apache and Mysql?
I need to do this in order to make a clean install of LAMP as I am trying to install a web based application that is ginving me lots of errors. So if you can also direct me to a good repository that has all updated for Centos 5.5 that will be very helpful.
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.


Author Comment

ID: 35144634
I had a mySQL installed and in it I have deleted all the users, so maybe what you are telling me about uninstalling MySQL won't remove databases applies to the problem I am running into. This problem is basically I can't access my MySQL with the root credentials.
I have forgot to mention that I have used yum for installation of the components of LAMP and when I had a problem in the root password of MySQL, I have reinstalled it using atomic rep. but still got the same problem of not allowing me to access MySQL. I need to remove any traces for the databases created as well as all the LAMP components and install a new one. So I really need help.
LVL 77

Accepted Solution

arnold earned 500 total points
ID: 35144702
make sure mysql is not running.
/sbin/service mysqld stop
cd /var/lib/mysql
mv mysql oldmysql
This will recreate a default mysql database with root login without a password/
/sbin/service mysqld start

mysql -u root
will get you into your mysql server and presumably you can take it from here.
If you need, you can then query the oldmysql for configuration information.

Author Comment

ID: 35144834
So Do you think having a combination of installations (like some from yum others from sudo atomic and reinstallations) won't interfere with the stability of the LAMP?
LVL 77

Expert Comment

ID: 35147304
You should select which package manager you want to use and stick with it.
Do you have two versions of mysql installed?
rpm -ql mysql-server
The info I provided deals with how you can regain access to your databases by resetting the mysql permissions.

Author Comment

ID: 35149784
But what I have installed sees each other. I don't know what package install as I have used:
yum install httpd
yum install mysql-server mysql
and then I removed mysql altogether and used the following command:
sudo yum install mysql-server mysql mysql-devel
I think it's all the same and it's all one package that is LAMP, isn't it?

Author Comment

ID: 35150421
when I wrote the above command you gave me I have got the following:
rpm -ql mysql-server
LVL 77

Expert Comment

ID: 35153190
Yes you have the same packages:

when you install a package/remove a package/install a package, the data such as with mysql /var/lib/mysql does not get touched. It remains. Such that if you forget the login you set, no matter how many times you go through the yum remove mysql-server yum install mysql the access will not be changed.

Author Comment

ID: 35166959
Yes I got this the hard way. But if I need to reinstall LAMP, do I just do yum remove for all components and then yum install for every component again? Thank you so much for your help.
LVL 77

Expert Comment

ID: 35167441
LAMP is a short hand for installing Linux as the OS and configuring the server as an Apache web server with PHP and mysql database backend.
The only thing you will be able to remove/reinstall are the components Apache, PHP, and Mysql.
For Linux you have to perform a complete reinstall i.e. boot from the linux install CD.

Author Comment

ID: 35168485
Where can I find a Linux install CD? Is this like an ISO that I can download online? So if I just issued yum remove httpd and yum remove php, yum remove mysql, won't it remove all the components and then I can issue install commands? I need this because when I point my browser to localhost, it gets me a blank page and the same with a php file test. The phpmyadmin is working though! If you have a solution to this then this may be better.
LVL 77

Expert Comment

ID: 35171702
apache, php, mysql are applications and can be removed/reinstalled/removed/reinstalled.
The only thing the remove part will remove is the parts it installed without the configurations nor the data.
So your remove/reinstall will not fix an configuration issue in most cases.

Linux is the underlying OS. You can download the Centos ISO from
Other options are Debian, Ubuntu. etc.

Files for web access need to be stored in /var/www/html
You can also configure
http://localhost/somedir to display a specific set of data.
What were you expected to see?
You should open a related question since this discussion is way off your original issue.

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question