Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I finally got a Raspberry Pi for Christmas and decided to set it up as a home web server. I have nginx with php setup and working. I came to install mysql and ran sudo apt-get install mysql-server. When setting the password I used a 32 character generated password with letters, numbers and symbols, however I don't believe it copied into the terminal correctly as I could not login with this password after the install.

After trying to reset the password (mysqld_safe --skip-grant-tables seemed to prevent me from connecting to mysql altogether (no sockets or network access was available after I started mysql with this flag). I decided a better approach would be to just completely re-install mysql as I had not setup any databases yet anyway. After doing plenty of apt-get purge mysql-server and trying to remove various folders I found that, apt-get purge mysql-server followed by a apt-get autoremove and then a restart seemed to correctly remove mysql (or so I thought) as the next install asked for a new root password.

As this install finished it failed to set the mysql unix user password (I had forgotten to remove it). This meant that mysql couldn't start and the installation is now sat in a partial state. Whenever I used apt-get to purge or autoremove it again attempts to complete the install. I've tried updating the mysql user to the new password I set however this has not allowed the install to complete.

How can I get apt-get to just rollback the install so I can start again rather than continuing to keep trying to complete a broken install?

share|improve this question
add comment

2 Answers

You could try removing the password:

sudo nano /etc/shadow

then locate the line about mysql:

mysql:[password hash here]:14804:0:99999:7:::

and replace the hash with *, which means no password.

share|improve this answer
1  
just tried this and doing apt-get purge, apt-get autoremove or apt-get remove still just shows apt-get trying to complete the mysql-server install. Cant seem to find a way to force an uninstall of a partial install –  ClearCarbon Dec 27 '12 at 18:28
add comment
up vote 0 down vote accepted

Finally figured it out with help from a friend, was dpkg --purge mysql-server and then the same again for another package that had gotten stuck in a partial install.

After the purge I simply removed the remaining mysql user and installed mysql-server again which asked for a root password and correctly added a user to the system.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.