1
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
Please can you add all of the "stuff about logging and starting the daemon" to the question. It's not possible to diagnose a problem if you edit out all of the diagnostic information. – Mike Scott – 2014-12-19T16:30:13.773
OK, thanks for that data. Now can you look in syslog to see what it's logged there? – Mike Scott – 2014-12-19T17:59:46.850
Where do I access syslog? – Luke Moll – 2014-12-19T20:21:15.250
I'm afraid that depends on how you've configured your system, but you could look for /var/syslog. – Mike Scott – 2014-12-19T21:11:50.227
It was in /var/log/syslog, I've re-run the command to get the output as it looks like syslog only keeps the most recent messages. – Luke Moll – 2014-12-20T10:30:05.763