Having trouble resetting mysql root password
/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables &
mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD("newrootpassword") where User='root';
mysql> flush privileges;
mysql> quit
/etc/init.d/mysql stop
/etc/init.d/mysql start
However, when I execute
/etc/init.d/mysql stop
I get ..
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mysql stop
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) utility, e.g. stop mysql
So then I try..
sudo service mysql stop
And then when I try to restart mysqld with
mysqld_safe --skip-grant-tables &
I get..
121111 07:32:29 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
121111 07:32:29 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
[1] + 24469 done mysqld_safe --skip-grant-tables
Then when I try to connect as root, I get..
~ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I'm not really sure where to go from here. I'd appreciate any help.
Thanks!
1 Reply
You can check if the process is still running with ps awwwx | grep [m]y. If it is, try connecting to it over a network port instead: mysql -u root –protocol=TCP -P 3306. If it isn't, look at the log files for an idea as to why it's exiting.