Failed to login to mysql

Hello everyone, when I write

mysql -u root

I get:

ERROR 2002 (HY000): Unable to connect to the local MySQL server through the socket '/var/run/mysqld/mysqld.sock' (2)

what to do next? I am in ubuntu.

+3
source share
2 answers

maybe something is wrong: mysqld may not be available, it may have permission problems, or there may be a problem with your binding address or network loop.

To find out which of these problems may occur, can you try running:

sudo /etc/init.d/mysql restart

and post if you get any errors (depending on your computer, which may also tell you to run:

sudo service mysql restart
+2
source

2002 (HY000): MySQL '/var/lib/mysql/mysql.sock

mysql, , , mysql .

MySQL ERROR 2002 (HY000): MySQL '/var/lib/mysql/mysql.sock'

:

mysql, mysql

/etc/init.d/mysqld MySQL

! !

root mysql

mysql> USE mysql;  
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';  
mysql> FLUSH PRIVILEGES;

mysql

  • root, -

mysql -u root -p
:
mysql > - ;

" " , - ;

mysql> GRANT ALL PRIVILEGES ON mytest.* TO 'guest'@'localhost' IDENTIFIED BY 'guest' WITH GRANT OPTION;

mysql username guest; !

+1

Source: https://habr.com/ru/post/1772427/


All Articles