2016-07-12

Okay, so first off, a back story. I come from a Windows environment, and I wanted to make Ubuntu my main dev'ment env. I started off by insalling the Lamp stack and all was okay, except when I reached MySQL. I think I missed something in the installation, but I couldn't access root. After a bit of digging -- and messing with files -- it turns out I can only access mysql> using sudo. But I'm used to phpmyadmin so I wanted to install that. I did, but turns out I can't access it because I can't sudo from the login screen on my browser. That's when I really messed up.

Long story short, I tried to uninstall it all together after trying to edit the root user and got completely locked out of mysql> and can't get back in. I tried many solutions to completely uninstall it, but everytime I try to apt-get install mysql-server, it tells me that it's already installed. When I run mysql or mysql -uroot etc, I get this

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

That's because I deleted all the files.

sudo apt-get install mysql-server gives me this:

Reading package lists... Done
Building dependency tree

Reading state information... Done
mysql-server is already the newest version (5.7.12-0ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 275 not upgraded.

I have no idea what to try next. Help!

EDIT:

Running sudo apt-get purge mysql*

isonuz@isuntuZ:~$ sudo apt-get purge mysql*

Reading package lists... Done

Building dependency tree

Reading state information... Done

Note, selecting 'mysqltcl' for glob 'mysql*'

Note, selecting 'mysql-mmm-agent' for glob 'mysql*'

Note, selecting 'mysql-workbench' for glob 'mysql*'

Note, selecting 'mysql-client-5.5' for glob 'mysql*'

Note, selecting 'mysql-client-5.6' for glob 'mysql*'

Note, selecting 'mysql-client-5.7' for glob 'mysql*'

Note, selecting 'mysql-mmm-tools' for glob 'mysql*'

Note, selecting 'mysql-common-5.6' for glob 'mysql*'

Note, selecting 'mysql-server-5.0' for glob 'mysql*'

Note, selecting 'mysql-server-5.1' for glob 'mysql*'

Note, selecting 'mysql-server-5.5' for glob 'mysql*'

Note, selecting 'mysql-server-5.6' for glob 'mysql*'

Note, selecting 'mysql-server-5.7' for glob 'mysql*'

Note, selecting 'mysql-utilities' for glob 'mysql*'

Note, selecting 'mysql-testsuite' for glob 'mysql*'

Note, selecting 'mysql-mmm-common' for glob 'mysql*'

Note, selecting 'mysql-server' for glob 'mysql*'

Note, selecting 'mysql-client' for glob 'mysql*'

Note, selecting 'mysql-sandbox' for glob 'mysql*'

Note, selecting 'mysql-client-core-5.5' for glob 'mysql*'

Note, selecting 'mysql-client-core-5.6' for glob 'mysql*'

Note, selecting 'mysql-client-core-5.7' for glob 'mysql*'

Note, selecting 'mysql-testsuite-5.5' for glob 'mysql*'

Note, selecting 'mysql-testsuite-5.6' for glob 'mysql*'

Note, selecting 'mysql-testsuite-5.7' for glob 'mysql*'

Note, selecting 'mysql-common' for glob 'mysql*'

Note, selecting 'mysql-mmm-monitor' for glob 'mysql*'

Note, selecting 'mysqltuner' for glob 'mysql*'

Note, selecting 'mysql-workbench-data' for glob 'mysql*'

Note, selecting 'mysql-server-core-5.1' for glob 'mysql*'

Note, selecting 'mysql-server-core-5.5' for glob 'mysql*'

Note, selecting 'mysql-server-core-5.6' for glob 'mysql*'

Note, selecting 'mysql-server-core-5.7' for glob 'mysql*'

Note, selecting 'mysql-source-5.7' for glob 'mysql*'

Package 'mysql-client-5.5' is not installed, so not removed

Package 'mysql-client-5.6' is not installed, so not removed

Package 'mysql-server-core-5.6' is not installed, so not removed

Package 'mysql-client-core-5.5' is not installed, so not removed

Package 'mysql-client-core-5.6' is not installed, so not removed

Note, selecting 'mysql-common' instead of 'mysql-common-5.6'

Package 'mysql-server-5.5' is not installed, so not removed

Package 'mysql-server-5.6' is not installed, so not removed

Package 'mysql-server-core-5.5' is not installed, so not removed

Package 'mysql-testsuite-5.5' is not installed, so not removed

Package 'mysql-testsuite-5.6' is not installed, so not removed

Package 'mysql-server-5.0' is not installed, so not removed

Package 'mysql-server-5.1' is not installed, so not removed

Package 'mysql-server-core-5.1' is not installed, so not removed

Package 'mysql-mmm-agent' is not installed, so not removed

Package 'mysql-mmm-common' is not installed, so not removed

Package 'mysql-mmm-monitor' is not installed, so not removed

Package 'mysql-mmm-tools' is not installed, so not removed

Package 'mysql-sandbox' is not installed, so not removed

Package 'mysql-utilities' is not installed, so not removed

Package 'mysql-workbench' is not installed, so not removed

Package 'mysql-workbench-data' is not installed, so not removed

Package 'mysqltcl' is not installed, so not removed

Package 'mysqltuner' is not installed, so not removed

Package 'mysql-source-5.7' is not installed, so not removed

Package 'mysql-testsuite' is not installed, so not removed

Package 'mysql-testsuite-5.7' is not installed, so not removed

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.

The following information may help to resolve the situation:

The following packages have unmet dependencies:

dbconfig-mysql : Depends: mysql-client but it is not going to be installed or
mariadb-client but it is not going to be installed or
virtual-mysql-client

E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

Running sudo apt-get autoremove

isonuz@isuntuZ:~$ sudo apt-get autoremove

Reading package lists... Done

Building dependency tree

Reading state information... Done

0 upgraded, 0 newly installed, 0 to remove and 291 not upgraded.

Running sudo apt-get install lamp-server^ phpmyadmin

isonuz@isuntuZ:~$ sudo apt-get install lamp-server^ phpmyadmin

Reading package lists... Done

Building dependency tree

Reading state information... Done

Note, selecting 'libhttp-message-perl' for task 'lamp-server'

Note, selecting 'libencode-locale-perl' for task 'lamp-server'

Note, selecting 'php7.0-cli' for task 'lamp-server'

Note, selecting 'mysql-client-5.7' for task 'lamp-server'

Note, selecting 'libapache2-mod-php' for task 'lamp-server'

Note, selecting 'rename' for task 'lamp-server'

Note, selecting 'mysql-server-5.7' for task 'lamp-server'

Note, selecting 'php-common' for task 'lamp-server'

Note, selecting 'libaprutil1' for task 'lamp-server'

Note, selecting 'mysql-server' for task 'lamp-server'

Note, selecting 'php7.0-opcache' for task 'lamp-server'

Note, selecting 'libcgi-fast-perl' for task 'lamp-server'

Note, selecting 'libwrap0' for task 'lamp-server'

Note, selecting 'libhttp-date-perl' for task 'lamp-server'

Note, selecting 'perl-modules-5.22' for task 'lamp-server'

Note, selecting 'liblwp-mediatypes-perl' for task 'lamp-server'

Note, selecting 'libfcgi-perl' for task 'lamp-server'

Note, selecting 'libcgi-pm-perl' for task 'lamp-server'

Note, selecting 'libaprutil1-dbd-sqlite3' for task 'lamp-server'

Note, selecting 'php7.0-common' for task 'lamp-server'

Note, selecting 'libaio1' for task 'lamp-server'

Note, selecting 'libio-html-perl' for task 'lamp-server'

Note, selecting 'ssl-cert' for task 'lamp-server'

Note, selecting 'apache2-data' for task 'lamp-server'

Note, selecting 'libperl5.22' for task 'lamp-server'

Note, selecting 'libapr1' for task 'lamp-server'

Note, selecting 'libaprutil1-ldap' for task 'lamp-server'

Note, selecting 'libhtml-tagset-perl' for task 'lamp-server'

Note, selecting 'mysql-client-core-5.7' for task 'lamp-server'

Note, selecting 'php7.0-json' for task 'lamp-server'

Note, selecting 'php7.0-readline' for task 'lamp-server'

Note, selecting 'tcpd' for task 'lamp-server'

Note, selecting 'liblua5.1-0' for task 'lamp-server'

Note, selecting 'mysql-common' for task 'lamp-server'

Note, selecting 'libhtml-template-perl' for task 'lamp-server'

Note, selecting 'libtimedate-perl' for task 'lamp-server'

Note, selecting 'apache2-bin' for task 'lamp-server'

Note, selecting 'perl' for task 'lamp-server'

Note, selecting 'apache2' for task 'lamp-server'

Note, selecting 'php-mysql' for task 'lamp-server'

Note, selecting 'apache2-utils' for task 'lamp-server'

Note, selecting 'libhtml-parser-perl' for task 'lamp-server'

Note, selecting 'libapache2-mod-php7.0' for task 'lamp-server'

Note, selecting 'liburi-perl' for task 'lamp-server'

Note, selecting 'mysql-server-core-5.7' for task 'lamp-server'

Note, selecting 'php7.0-mysql' for task 'lamp-server'

apache2 is already the newest version (2.4.18-2ubuntu3).

apache2-bin is already the newest version (2.4.18-2ubuntu3).

apache2-data is already the newest version (2.4.18-2ubuntu3).

apache2-utils is already the newest version (2.4.18-2ubuntu3).

libaio1 is already the newest version (0.3.110-2).

libapache2-mod-php is already the newest version (1:7.0+35ubuntu6).

libapr1 is already the newest version (1.5.2-3).

libaprutil1 is already the newest version (1.5.4-1build1).

libaprutil1-dbd-sqlite3 is already the newest version (1.5.4-1build1).

libaprutil1-ldap is already the newest version (1.5.4-1build1).

libcgi-fast-perl is already the newest version (1:2.10-1).

libcgi-pm-perl is already the newest version (4.26-1).

libencode-locale-perl is already the newest version (1.05-1).

libfcgi-perl is already the newest version (0.77-1build1).

libhtml-parser-perl is already the newest version (3.72-1).

libhtml-tagset-perl is already the newest version (3.20-2).

libhtml-template-perl is already the newest version (2.95-2).

libhttp-date-perl is already the newest version (6.02-1).

libhttp-message-perl is already the newest version (6.11-1).

libio-html-perl is already the newest version (1.001-1).

liblua5.1-0 is already the newest version (5.1.5-8ubuntu1).

liblwp-mediatypes-perl is already the newest version (6.02-1).

libperl5.22 is already the newest version (5.22.1-9).

libtimedate-perl is already the newest version (2.3000-2).

liburi-perl is already the newest version (1.71-1).

libwrap0 is already the newest version (7.6.q-25).

perl is already the newest version (5.22.1-9).

perl-modules-5.22 is already the newest version (5.22.1-9).

php-common is already the newest version (1:35ubuntu6).

php-mysql is already the newest version (1:7.0+35ubuntu6).

rename is already the newest version (0.20-4).

ssl-cert is already the newest version (1.0.37).

tcpd is already the newest version (7.6.q-25).

libapache2-mod-php7.0 is already the newest version (7.0.4-7ubuntu2.1).

mysql-client-5.7 is already the newest version (5.7.12-0ubuntu1.1).

mysql-client-core-5.7 is already the newest version (5.7.12-0ubuntu1.1).

mysql-common is already the newest version (5.7.12-0ubuntu1.1).

mysql-server is already the newest version (5.7.12-0ubuntu1.1).

mysql-server-5.7 is already the newest version (5.7.12-0ubuntu1.1).

mysql-server-core-5.7 is already the newest version (5.7.12-0ubuntu1.1).

php7.0-cli is already the newest version (7.0.4-7ubuntu2.1).

php7.0-common is already the newest version (7.0.4-7ubuntu2.1).

php7.0-json is already the newest version (7.0.4-7ubuntu2.1).

php7.0-mysql is already the newest version (7.0.4-7ubuntu2.1).

php7.0-opcache is already the newest version (7.0.4-7ubuntu2.1).

php7.0-readline is already the newest version (7.0.4-7ubuntu2.1).

phpmyadmin is already the newest version (4:4.5.4.1-2ubuntu2).

0 upgraded, 0 newly installed, 0 to remove and 291 not upgraded.

<<<< SOLVED >>>>

sudo apt-get purge mysql* wasn't completely uninstalling it, so I went crazy and did

sudo apt-get purge mysql php apache lamp
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install lamp-server^
sudo apt-get install phpmyadmin
sudo apt-get install php-mbstring php7.0-mbstring php-gettext

And of course made the necessary configurations. The problem ultimately was that I was setting up mysql without a password. This works in Windows, but apparently not on Ubuntu. So I just set a password for it this time around and it all worked as it should.

Show more