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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 78

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.
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.


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 78

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 78

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 78

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 78

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 78

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

707 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