I've installed mysql-server
on a Linux box and forgot (oops) the root password. Having looked around the internet, the general method is so:
- Stop MySQL (
sudo service mysql stop
) - Start MySQL in special mode (
sudo mysqld_safe --skip-grant-tables
) - Login to local server and reset password (
mysql -u root
)
My problem is at number 2. When I run the command, it says some stuff about logging and starting the daemon, then ends with the line
mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
and using sudo service mysql status
confirms that MySQL has, indeed stopped.
Why does it stop so suddenly? And (more importantly) how can I get it to keep running so I can reset my password?
Thanks in advance
EDIT Here's the full log of "stuff about loggin and starting the daemon":
$ mysqld_safe --skip-grant-tables
141219 16:55:20 mysqld_safe Logging to syslog.
141219 16:55:20 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
141219 16:55:20 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
$
EDIT 2 And the output of /var/log/syslog (I've replaced my hostname with <hostname>
)
Dec 20 10:20:09 <hostname> mysqld_safe: Starting mysqld daemon with databases from /var/lib/mysql
Dec 20 10:20:09 <hostname> mysqld: 141220 10:20:09 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
Dec 20 10:20:09 <hostname> mysqld: 141220 10:20:09 [Warning] Can't create test file /var/lib/mysql/<hostname>.lower-test
Dec 20 10:20:09 <hostname> mysqld: 141220 10:20:09 [Warning] Can't create test file /var/lib/mysql/<hostname>.lower-test
Dec 20 10:20:09 <hostname> mysqld: #007/usr/sbin/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 13)
Dec 20 10:20:09 <hostname> mysqld: 141220 10:20:09 [ERROR] Aborting
Dec 20 10:20:09 <hostname> mysqld:
Dec 20 10:20:09 <hostname> mysqld: 141220 10:20:09 [Note] /usr/sbin/mysqld: Shutdown complete
Dec 20 10:20:09 <hostname> mysqld:
Dec 20 10:20:09 <hostname> mysqld_safe: mysqld from pid file /var/run/mysqld/mysqld.pid ended