0

I am using Ubuntu 19.10 and installed mysql-server on it. First it gave me an error

error was mysql access denied for user 'root'@'localhost'

solved by code below

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

based on an answer here https://stackoverflow.com/questions/41645309/mysql-error-access-denied-for-user-rootlocalhost

I had rebooted the virtual machine now when I try to login

debian@osboxes:~$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I tried following

debian@osboxes:~$ mysql -u root -p 123456
Enter password: 
ERROR 1049 (42000): Unknown database '123456'

I want to know what mistake I am doing. I am trying to use mysql for some assignments is the above not the correct way to go to an sql prompt. What else should I do? I am using Ubuntu 19.10.

I don't have any idea of upstart echo system back in those days we used to have init scripts to start and stop daemons so I am browsing internet and it has become quite confusing what to do and what not to do. Like is the mysql service not available these days or what exactly I need to do to make sure after reboot mysql service is running. Which files should I check.

2
  • Suggestion: Never supply password in plain text. You can rather use mysql -u root -p to get a prompt for password.
    – Kulfy
    Jan 7, 2020 at 10:49
  • Yes you are right I came to use sql after many many days so I have forgotten every thing about it. Jan 7, 2020 at 11:01

1 Answer 1

0

Your command syntax is wrong, this is why it is not working, get rid of the empty space between -p and your password.

mysql -u root -p123456

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .