Why do I get an error message when I try to access mysql?
When I try to access mysql. I got following error message:
ERROR 1045 (28000): Access denied for user 'hjbtech'@'localhost' (using password: YES)
Note: Following "secure your server" guide. I created a sudo user instead of using 'root'
I have tried with the sudo user password and without one.
2 Replies
Have you created a MySQL user yet? If so, then it looks like either the password is incorrect or the MySQL user doesn't have permissions for the database you wanted to access. We have many different distro specific guides for setting up MySQL that may help.
In general, when you first log into MySQL use:
mysql -u root -p
You'll want to use the password you set up when installing MySQL.
Then, you'll want to run the following commands from the MYSQL prompt to create the database, create the user, and give it database permissions respectively:
create database testdb;
create user 'testuser'@'localhost' identified by 'password';
grant all on testdb.* to 'testuser' identified by 'password';
Hi,
I installed LAMP stack using tasksel following this link: I did not install packages separately
https://www.linode.com/docs/web-servers/lamp/install-lamp-stack-on-ubuntu-18-04/#install-packages-separately
On completion, I was able to manually confirm that Apace2, mysql and php were installed
During the install I was not asked to create a password.
Is it better to purge the tasksel install and install the packages manually?
Or is there another option?