0

I am using ubuntu 16.04 and have just installed mysql. However, I am not able to access the mysql shell. I keep getting the Error 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Could you please help. Thanks.

m_h
  • 199
  • 1
  • 4
  • 14

4 Answers4

0

Maybe hard resetting the password helps. Alot of people are getting this issue.

Take a look here: https://stackoverflow.com/a/21685641/1863487

Community
  • 1
  • 1
Fjarlaegur
  • 1,395
  • 1
  • 14
  • 33
  • Unfortunately, among the instructions there is mysql -u root, which does not work for me : ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' – m_h Mar 30 '17 at 06:21
  • Then it probably isnt running. Can you try `sudo service mysqld start`? – Fjarlaegur Mar 30 '17 at 07:44
  • [No more](https://askubuntu.com/a/793630/349837) `service`, [now is](https://www.cyberciti.biz/faq/howto-install-mysql-on-ubuntu-linux-16-04/) `sudo systemctl restart mysql.service`. – Pablo Bianchi Sep 30 '17 at 03:46
0

Thanks for the comments. I solved the problem by reinstalling mysql from the mysql-api-config_0.3.8.1_all.deb file and can now access the mysql shell.

m_h
  • 199
  • 1
  • 4
  • 14
0

I had the same issue and this helped:

sudo mysql -u root -p
Pang
  • 9,564
  • 146
  • 81
  • 122
Benil Raj
  • 1
  • 1
0

I solve problem like this : add [mysqld] skip-grant-tables to this file --> nano /etc/mysql/my.cnf' then ----> mysql -u root set root password--> UPDATE mysql.user SET authentication_string=PASSWORD('root'), plugin='mysql_native_password' WHERE User='root' AND Host='localhost';FLUSH PRIVILEGES; exit console \q comment edited file with # on start of line restart mysql --> sudo service mysql restart and at last --> sudo mysql -u root -p`

Mostafa
  • 815
  • 1
  • 13
  • 23