O
O
Outsider V.2016-02-01 16:15:23
MySQL
Outsider V., 2016-02-01 16:15:23

How to set password on MySQL via shell?

I've been suffering for the second hour, I'm rearranging the MySQL server on CentOS for the 5th time ...
I work through Xshell with VDS (CentOS 7). I install mysql:

yum install mysql mysql-server

service start mysqld works fine, but when I type mysql -u root -p I get this nonsense:
a12da826153c4e84bd9ec2aa47b84b21.PNG
I type the password - nothing is entered in the console. I press enter - writes
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[[email protected] ~]#

When you try to do something from mysqladmin - writes the same, Access denied for user 'root'@'localhost' (using password: NO).
I didn't set any password. Then I tried mysqladmin -u root - p new_password - no effect, and on the Internet I found a recommendation to run "# /usr/bin/mysql_secure_installation" - so it throws the same Access denied error.
Help someone - what to do??

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
O
Outsider V., 2016-02-01
@Audiophile

Why isn't this in the manual??? Just found this on stackoverflow:
And I spent three hours on this :/

P
Puma Thailand, 2016-02-01
@opium

Log in without a password without the option minus pe

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question