1

I'm trying to install MySQL on a raspberry PI 2. First I tried the obvious and just ran: (sudo apt-get install mysql-server). That ultimately fails, looking like this:

-----NOTE-----
The picture below shows that MySQL-server is already installed and of the latest version. This is just because I took the screen shot after a recent failure and had run the install command again so I could replicate the error for the screenshot. With each attempt to try a different fix I have completely remove MySQL-server and all of it's dependencies.
-----NOTE----- enter image description here

So then I tried to run (sudo dpkg --configure mysql-server-5.5) and (sudo apt-get install -f) to try and fix the pakage and then tried to run (sudo apt-get install mysql-server) once more. I got the same errors. So then I compleately removed everything, including the folders created by the setup and tried to install from a tarball. That pretty much led me to the same place as before. I've looked through dozens of forums trying to find an answer but all the issues I found with PI and mysql had to do with a conflict with an older firmware. Does anyone have any suggestions for me?

-----UPDATE 3/4/15 9:16PM-----

It was suggested that I install synaptic and try to use it to install in hopes that it might be able to better handle the errors I am receiving. Unfortunately that failed as well giving me the following:

enter image description here

  • What does sudo apt-get install mysql do? – joan Mar 4 '15 at 18:25
  • nothing, The package no longer exists. evidently it got split up into mysql-server and mysql-client. running (sudo apt-get install mysql-server) is supposed to install both. – Nathan Thomas Mar 4 '15 at 18:34
  • Quite right, my mistake. All I can suggest is trying synaptic if it's installed on the Pi. Sometimes it's better at showing broken packages. – joan Mar 4 '15 at 19:06
  • Unfortunately raspbian (the pi's flavor of linux) doesn't have synaptic, it has its own manager type program similar to synaptic but it doesn't have anything for SQL. – Nathan Thomas Mar 4 '15 at 19:17
  • 1
    Something was wrong when you started the error output says that the server is already the latest version but then proceeded to try and install. Did you install something that had MySQL as a dependency? You may be able to do sudo apt-get purge <package name> for all of the installed MySQL Packages. then retry the install. You may be able to do this with a regex sudo apt-get remove '^mysql.*' note this will remove all packages that start with mysql. This may be more than you intend. – Steve Robillard Mar 4 '15 at 21:19
1

I discovered that my issue was occurring because the loop back interface was disabled... why it was disabled I have no idea, but once I turned it back on mysql started without a problem.

  • 2
    Could you point me out on how to do that please? I'm having the very same problem and I lost hours to it last night... – Matt Wilcox Dec 8 '15 at 10:17
0

Assuming a stock Raspbian installation;

Type in the following line which will find the latest lists of available software;

sudo apt-get update

You should see a list of text scroll up while the Pi is downloading the latest information.

Then we want to upgrade our software to latest versions from those lists using;

sudo apt-get upgrade

The Pi should tell you the lists of packages that it has identified as suitable for an upgrade and along with the amount of data that will be downloaded and the space that will be used on the system. It will then ask you to confirm that you want to go ahead. Tell it 'Y' and we will see another list of details as it heads off downloading software and installing it.

From the command line run the following command;

sudo apt-get install mysql-server

The Raspberry Pi will advise you of the range of additional packages that will be installed at the same time. Agree to continue and the installation will proceed. This should take a few minutes or more (depending on the speed of your internet connection).

You will be prompted (twice) to enter a root password for your database. Note it down somewhere safe;

enter image description here

Make this a reasonably good password. You won't need it too much, so it's reasonable to make it more secure.

Once this installation is complete, we will install a couple more packages that we will use in the future when we integrate PHP and Python with MySQL. To do this enter the following from the command line;

sudo apt-get install mysql-client php5-mysql python-mysqldb

Agree to the installed packages and the installation will proceed fairly quickly.

That's it! MySQL server installed

You can find this information and some more on installing PHPMyAdmin remotely to manage it here https://leanpub.com/RPiMRE/read#leanpub-auto-mysql-1

  • Thank you for your response and you attempt to help. Unfortunately these instruction don't do me any good because it's the path I started on to begin with. If you look at my post you can see that (sudo apt-get install mysql-server) fails while trying to start mysqld (the name of the service for mysql server). The output tells me this is because mysql-server-5.5 is not configured properly but it's supposed to get configured by the script when you get prompted for the passwords. – Nathan Thomas Mar 5 '15 at 2:47
  • Ahh... Glad to see that you got it resolved. – d3noob Mar 5 '15 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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