MySQL Access denied after typing 'mysql -proot' - mysql

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

Related

How can I restart mysql without getting this error?

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.

MySQL connection from command line, how can be a command line utility so unstable?

Since a few hours I'm trying to connect to a local sql environment. It works in one second with MySQL Workbench, but from the commandline MySQL is not very verbose :)
mysql -u root -p root --host=127.0.0.1 --port=10011 -password'root'
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
Somewhere they report to use -u, while somewhere else they suggest --u
How do I find out if mysql is able to reach the server?
What else can I do for troubleshooting?
MySQL command line is a mess, the solution was
mysql -uroot -h127.0.0.1 --port=10011 -proot
Some with -- like port and some with - like p, and with no space.

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 cannot connect to database if password is specified inline

I have a problem that I think it is something easy.
I want to connect to mysql database.
If I do the following:
mysql -uroot -premoved mydatabase
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
But if I do:
mysql -uroot -p mydatabase
Enter password: removed
mysql>
It works!!
Why?
You need single quotes around your password.
mysql -uroot '-pabc$def' mydatabase
See mysql password is messing up my dump for reference.

error 1045 (28000) access denied for user 'root'#'localhost' (using password: YES)

Please forgive me for being a complete beginner:
I am trying to log into my very first mySQL database that I installed using easyPHP on my windows machine, using the cmd line. I am going to the \mysql\bin and entering the command:
mysql -u root
in order to log in, but I am getting the following message:
error 1045 (28000) access denied for user 'root'#'localhost' (using password: YES)
Why is it using the password "YES"? Shouldn't there be no password at all? Do I need to restart mySQL or something? If so, how do I do that? If it's relevant, I did try to create the database using phpmyadmin, but had a few problems entering columns and decided I'd be better off working from the command line so I could learn all the commands as I went along.
Please keep in mind that this is my first time ever trying to work with a database, so be kind to me!
To have mysql asking you for a password, you also need to specify the -p-option:
mysql -u root -p
When logging into MYSQL using the command line, you also have to specify the password if any. Your error message is telling you that the user "root" has a password attached to it. Not necessarily that the password is "YES" when you were installing easyPHP, it should have either provided you with a default password or allowed you to enter a password of your choosing.
According to the documentation of easyPHP:
[v1.6] My scripts worked perfectly with 1.5 but now I get this error : Warning: Forbidden access for user: 'user#localhost' (password: YES) when I want to connect to MySql.
Only the root user (without password) has the rights to connect to the database. Either modify your scripts to use it, or add the user you need (phpMyAdmin/users and privileges: See phpMyAdmin's documentation for more information).
mysql -u root -p
Now if you changed your root user password, you will need to specify that when prompted. Otherwise simply hit <Enter> on your keyboard.
If you FORGOT the password to root, and have changed it, you will have to subsequently reinstall easyPHP.
agk-hp:~/$mysql
ERROR 1045 (28000): Access denied for user 'greg'#'localhost' (using password: NO)
agk-hp:~/$sudo cat /etc/mysql/debian.cnf|grep password
password = t7753my3D2x4yfQm
agk-hp:~/$mysql -u debian-sys-maint -p
Enter password: {t7753my3D2x4yfQm}
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> use mysql;
mysql> grant all privileges on *.* to 'root'#'localhost';
mysql> grant all privileges on *.* to 'greg'#'localhost';
agk-hp:~/$mysql
mysql>
A modification for mysql- 5.7.10 on mac mac el capitan
sudo /usr/local/mysql/support-files/mysql.server stop
sudo mysqld_safe --skip-grant-tables
Now open new window/tab on terminal and type
"mysql -u root"
use mysql
update user set authentication_string=password('yourpassword') where user='root';