I installed LAMP on Ubuntu 12.04 LTS (Precise Pangolin) and then set root password on phpMyAdmin. I forgot the password and now I am unable to login. When I try to chan
By experience I say that you need to check if the server is running first and then try configuring MySQL. The last solution is to re-install MySQL.
In my case, the default port 3306 was being used by some other process and thus it was not starting. After I stopped the other service and did sudo service mysql start
, it worked fine. BTW, you can use something like sudo lsof -Pn -iTCP:3306
to see who may be using the port.
Instead of using localhost:
mysql -u myuser -pmypassword -h localhost mydatabase
Use 127.0.0.1
mysql -u myuser -pmypassword -h 127.0.0.1 mydatabase
(also note, no space between -p and mypassword)
Enjoy :)
On Debian server Jessie, my working solution was to simply do
service mysql restart
service mysql reload
as root user
If your installation was recent, you should to confirm if your installation is the installation SERVER... as mysql-server-5.5.. Maybe you installed only "mysql" .. this is only client instead of the server.
I had a similar problem. mysql wouldn't start:
sudo service mysql start
start: Job failed to start
If I disabled apparmor:
sudo aa-complain /etc/apparmor.d/*
the problem went away. The issue was that mysqld was trying to access /run/mysqld/mysqld.sock but the apparmor profile only gave permission to /var/run/mysqld/mysqld.sock (/var/run is symlinked to /run, so these are actually the same). Not sure why mysqld isn't using the var path since that's what's set in all the configuration files, but you can fix the problem by adding the following to /etc/apparmor.d/usr.sbin.mysqld
/run/mysqld/mysqld.pid rw,
/run/mysqld/mysqld.sock rw,