The problem is quite frequent, I tried all the tips from the English-language stack`a, but it does not work. Once I installed the MySQL client and server, I dabbled, now I needed to install everything normally, using this cheat sheet I cleaned everything that was connected with MySQL Server & Client and now installed it in a new way, through

sudo apt-get install mysql-server mysql-client 

In theory, during installation, they should offer to set a password for root, but this did not happen.

When everything is established, I enter the command mysql -u root

Access denied for user 'root' @ 'localhost' (using password: NO)

I tried to perform the following actions:

 sudo /etc/init.d/mysql stop sudo mysqld_safe --skip-grant-tables & 

Then got this:

2019-02-26T15: 23: 51.419680Z mysqld_safe Logging to syslog. 2019-02-26T15: 23: 51.425030Z mysqld_safe Logging to '/var/log/mysql/error.log'. 2019-02-26T15: 23: 51.429211Z mysqld_safe Directory '/ var / run / mysqld' for UNIX socket file don't exists.

  • Well, just did not try to enter sudo mysql ? And in general, what version of MySQL are we talking about? From this will depend on the recipes "treatment". If version 5.7 or fresh, then you can set the password, it seems, through the sudo mysql_secure_installation . - Vladimir
  • I entered sudo mysql_secure_installation and got sudo mysql_secure_installation, then I had to enter a password that I either don’t remember or didn’t even create. at least when reinstalling, I definitely did not create. Version mysql 5.7.25 - Hundreds of Personalities
  • If I remember correctly, then after mysql_secure_installation password will be mysql_secure_installation to enter only if you give up the first two points (something about additional checks and authentication via a socket). If you have not abandoned the new authentication (via socket), then there will be no password. And then, it seems, the input will be allowed only through sudo mysql . - Vladimir
  • @Vladimir sudo mysql_secure_installation Securing the MySQL server deployment. Enter password for user root: Error: Access denied for user 'root'@'localhost' (using password: NO) sudo mysql_secure_installation Securing the MySQL server deployment. Enter password for user root: Error: Access denied for user 'root'@'localhost' (using password: NO) that is, no matter what I click there, he asks for a password anyway - Hundreds of Persons
  • So what about the sudo mysql command? So, too, does not let? - Vladimir

0