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
I got this problem too, but I just did:
sudo service mysql restart
It worked for me.
Make sure you have backups of important databases and then try uninstall MySQL related stuff:
apt-get remove --purge mysql\*
Then install it again:
apt-get install mysql-server mysql-client
This worked for me and data was kept.
If PHP MySQL shows errors you might have to reinstall PHP MySQL:
apt-get install php5-fpm php5-mysql
I also facing same problem it will be occur if your mysql server
is not running by default it will again stop after some sec so you again run ($ sudo service mysql start
) command you can change if know.
for that use command
$ sudo service mysql start
(put user password if required because we use sudo
)
and then run
$ sudo mysql -u root -p (put user password if required )
now you got your database
I solved this by killing the mysql
process:
ps -ef | grep mysql
kill [the id]
And then I started the server again with:
sudo /etc/init.d/mysql restart
But start
works as well:
sudo /etc/init.d/mysql start
Then I logged in as admin
, and I was done.
In my case it worked by doing some R&D:
I am able to connect to MySQL using
root-debian#mysql -h 127.0.0.1 -u root -p
But it's not working with mysql -u root -p
.
I did not find any bind-address
in my.cnf. So I outcommented the parameter socket=/var/lib/mysql/mysqld.sock
in my.cnf
which was causing me a problem with login.
After restarting the service it went fine:
root@debian:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.19 MySQL Community Server (GPL)
I tried the following steps:
super user
or use sudo
/etc/mysql/my.cnf
using geditbind-address
, and change its value to the database server host machine's IP address. For me, it was localhost
or 127.0.0.1
sudo service mysql start
And it worked for me.