So I’m running crunchbang linux and installed mysql-server using the following terminal command:
sudo apt-get install mysql-server
Setup runs without problems, but when trying to access mysql I get “Error 1045 Access denied”.
ERROR 1045 (28000): Access denied for user ‘username’@’localhost’ (using password: NO)
The same goes for using root.
The tutorial I used stated that during setup of mysql-server I’d be asked to set a password, but this step never happened.
Edit:
Completely removed everything related to mysql from my system (including configuration files), problem persists.
When trying
mysql -u root mysql
the error also occurs, although according to the documentation this should grant me access if no password is set.
___Update:
Since I’m still having this problem even with my new laptop (running ubuntu 12.10 now) I’ll do a quick update:
Neither
sudo dpkg-reconfigure mysql-server
nor
mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
worked. Any thoughts?
__Update 2
By stopping the service and then following this guide I seem to have managed to reset the root password.
Still, using
mysql -u root -p
and entering the password I’ve set, it still throws access denied.
Okay my suspicion was right: I installed mysql using the synaptic package manager and during setup this seemed to skip the step of setting a root password. I don’t know why the password reset didn’t work, but after installing mysql from commandline everything’s working perfectly.