Ubuntu – MySql won’t start after installation on Ubuntu server 14.04.1

MySQLserver

I'm new to Ubuntu server and MySql. I'm attempting to create a server in VirtualBox that I can use for web development and testing before deploying to a real server. I have Ubuntu server 14.04.1 installed and running in a virtual machine. PHP is working fine. I can access anything I put in the /var/www/html folder from my web browser on my host machine. I cannot get MySql to start. I tried uninstalling the version that came with Ubuntu and reinstalling from the MySql repository at dev.mysql.com and it still won't start. The previous version was giving me an error with a ".sock" file, the name of which I cannot remember. Now it simply says it cannot start, stating only that the log files are inaccessible. I have been searching google for almost two days and have not found any solutions that work. I am fairly new to Unix terminals, so forgive me if I misunderstand things.

MySql service status:

eric@Server:~$ sudo service mysql status
sudo: /var/lib/sudo owned by uid 1000, should be uid 0
[sudo] password for eric:
* MySQL Community Server 5.6.21 is not running

Here is what I get when I try to start MySql:

eric@Server:~$ sudo service mysql start
sudo: /var/lib/sudo owned by uid 1000, should be uid 0
[sudo] password for eric: 
No directory, logging in with HOME=/
touch: cannot touch ‘/var/log/mysql/error.log’: Permission denied
chmod: cannot access ‘/var/log/mysql/error.log’: Permission denied
/usr/bin/mysqld_safe: 129: /usr/bin/mysqld_safe: cannot create  /var/log/mysql/error.log: Permission denied
/usr/bin/mysqld_safe: 1: eval: cannot create /var/log/mysql/error.log: Permission denied
touch: cannot touch ‘/var/log/mysql/error.log’: Permission denied
chown: cannot access ‘/var/log/mysql/error.log’: Permission denied
chmod: cannot access ‘/var/log/mysql/error.log’: Permission denied
/usr/bin/mysqld_safe: 129: /usr/bin/mysqld_safe: cannot create /var/log/mysql/error.log: Permission denied
......
* MySQL Community Server 5.6.21 did not start. Please check logs for more details.

And here is mysql –verbose –help (I cut out the help section from the top)

eric@Server:~$ sudo mysql --verbose --help
sudo: /var/lib/sudo owned by uid 1000, should be uid 0
[sudo] password for eric: 
mysql  Ver 14.14 Distrib 5.6.21, for Linux (x86_64) using  EditLine wrapper
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

[content cut]

Variables (--variable-name=value)
and boolean options {FALSE|TRUE}  Value (after reading options)
--------------------------------- ----------------------------------------
auto-rehash                       TRUE
auto-vertical-output              FALSE
bind-address                      (No default value)
character-sets-dir                (No default value)
column-type-info                  FALSE
comments                          FALSE
compress                          FALSE
debug-check                       FALSE
debug-info                        FALSE
database                          (No default value)
default-character-set             auto
delimiter                         ;
enable-cleartext-plugin           FALSE
vertical                          FALSE
force                             FALSE
named-commands                    FALSE
ignore-spaces                     FALSE
init-command                      (No default value)
local-infile                      FALSE
no-beep                           FALSE
host                              (No default value)
html                              FALSE
xml                               FALSE
line-numbers                      TRUE
unbuffered                        FALSE
column-names                      TRUE
sigint-ignore                     FALSE
port                              3306
prompt                            mysql> 
quick                             FALSE
raw                               FALSE
reconnect                         TRUE
socket                            /var/run/mysqld/mysqld.sock
ssl                               FALSE
ssl-ca                            (No default value)
ssl-capath                        (No default value)
ssl-cert                          (No default value)
ssl-cipher                        (No default value)
ssl-key                           (No default value)
ssl-crl                           (No default value)
ssl-crlpath                       (No default value)
ssl-verify-server-cert            FALSE
table                             FALSE
user                              (No default value)
safe-updates                      FALSE
i-am-a-dummy                      FALSE
connect-timeout                   0
max-allowed-packet                16777216
net-buffer-length                 16384
select-limit                      1000
max-join-size                     1000000
secure-auth                       TRUE
show-warnings                     FALSE
plugin-dir                        (No default value)
default-auth                      (No default value)
histignore                        (No default value)
binary-mode                       FALSE
connect-expired-password          FALSE

Let me know if you need any other information. I really want to get this working so I can start my web development.

Thank you in advance for any and all help!

Eric

Best Answer

I suspect that this might an issue with the permission MySQL user to run the execute. Please try running the below command and check whether your issue is fixed.

chown mysql /var/run/mysqld