How can I restart mysql without getting this error? - mysql

sudo service mysql restart
But I get
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
I then enter and can enter mysql without any problem.
mysql -u root -h localhost -ppassword databasename
My question is that, can I restart mysql service without getting that error by maybe supplying hostname and password straight away.

somtimes error occurs but changing mysql password can solve the error.
and once you changed your password, you're error free.

Related

I cant connect mysql

When I try to enter the root user from MySQL Workbench and manually enter it, I get the following error:
your connection attempt failed for user root to the mysql server
Access denied for user 'root'#'localhost' (using password: YES)
I am using mysql -u root code when I want to connect to MySQL via cmd and I get an error in it:
mysql: Unknown operating system character set 'cp857'.
mysql: switch to the default character set of 'utf8mb4'.
ERROR 1045 (28000): Access was denied for the user 'root'#'localhost' (using password: No)
I get a similar error when I try to log in using a password, the only thing that changes is (using password: YES).
What had I better do?
Issue with your password so simply change mysql root password.
here command
mysql -u root
then
mysqladmin -u root password [newpassword]
may help you this.
thanks

Why do these approaches not reset my Mysql root password?

I have set a root password, but cannot authenticate with it. How can I reset this password?
~ mysql --version: mysql  Ver 8.0.13 for osx10.14 on x86_64 (Homebrew)
I used these stackoverflow instructions to set a root password and queried the user table to verify the password.
I then tried mysql -u root -p and mysql -u root and got authentication errors.
Command: mysql -u root -p
Authentication error: ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES). I am SURE I am using the correct password.
Command:mysql -u root
Authentication error: Error: ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO).
That led me to this this stackoverflow question and attempted #Lahiru's solution, but got No such file or directory.
I found the Mysql documentation and performed the following: (as outlined in B.6.3.2.3 Resetting Root Password: Generic Instructions)
mysql.server start --skip-grant-tables
Mysql -u root
FLUSH PRIVILEGES
ALTER USER 'root'#'localhost' IDENTIFIED BY 'MyNewPass';
Then I got an error:
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
Lastly, using the Mysql 8.0 documentation: 13.7.1.10 SET PASSWORD Syntax I tried:
mysql.server start --skip-grant-tables
SET PASSWORD FOR 'root'#'localhost' = '1111';
and get error: ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
I can't try to do this while running the server out of safe mode because it doesn't accept the password I set.
Thanks in advance for any help.

I have ubuntu installed with mysql .the below error keeps showing up

linux#ubuntu:~$ mysql
ERROR 1045 (28000): Access denied for user 'linux'#'localhost' (using password: NO)
linux#ubuntu:~$ mysql -u -p
ERROR 1045 (28000): Access denied for user '-p'#'localhost' (using password: NO)
linux#ubuntu:~$
I have ubuntu 14. installed with mysql on a virtual machine vmware .
The above error keeps showing up and I only see the solution everywhere on the internet as :
use "mysql -u -p" but still the error occurs.
It should have space, try this:
mysql -u {username} -p
if you didn't configure mysql(setting password for user), then use just
mysql -uroot, You should mention username.
You can set password for default user root by
mysqladmin -uroot password yourpassword
after setting password run
mysql -uroot -pyourpassword

MySQL Access denied after typing 'mysql -proot'

I am new to MySQL. My issue is, is that after typing mysql -proot in the terminal I am receiving this error:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I don't know what i am doing wrong. I did create a password. However I don't really know how to put it in, in combo with this command.
I am using CentOS 6 on my server
It's a typo on the syntax. You need a space between proot. It should be
mysql -p root
instead of
mysql -proot
mysql -proot this command is telling mysql to use root as the password, which I'm assuming is not the password. You need to put a space between the -p switch and the username to be get the interactive password prompt.
mysql -p root

Login ERROR 1698 (28000): Access denied for user 'root'#'localhost'

I just installed MySQL server on my Ubuntu machine. All installed ok, when it asked for my password, I simply hit 'enter' so as to leave the password blank. Now when I try to login:
mysql -u root -p
and simply hit enter, I get the following error:
ERROR 1698 (28000): Access denied for user 'root'#'localhost'
I don't understand what the error is or how to fix it. Please can someone help? I've tried to read the MYSQL Docs but I don't understand what they're saying.
I also get an "Access Denied" page when I try to access phpMyAdmin
Had the same issue. Executing with Super user privileges worked for me.
sudo mysql -u root -p
Have you tried to ommit -p for password free login?
mysql -u root