본문 바로가기

programming/Linux

ERROR 1045 (28000): Access denied for user '-root'@'localhost' (using password: YES)

자꾸 비밀번호 틀렸다고 해서 빡치던 와중

이것 저것 해봐도 안되다가 방법을 찾아냄

 

using password: NO 가 뜨도록 패스워드 입력하지 말고 엔터를 치라는 글을 발견

그대로 실행해봄


[root@localhost init.d]# /usr/bin/mysql -u -root -p
Enter password:
ERROR 1045 (28000): Access denied for user '-root'@'localhost' (using password: YES)
[root@localhost init.d]# /usr/bin/mysql -u -root -p
Enter password:
ERROR 1045 (28000): Access denied for user '-root'@'localhost' (using password: YES)
[root@localhost init.d]# /usr/bin/mysql -u -root -p
Enter password:
ERROR 1045 (28000): Access denied for user '-root'@'localhost' (using password: YES)
[root@localhost init.d]# /usr/bin/mysql -u -root -p
Enter password:
ERROR 1045 (28000): Access denied for user '-root'@'localhost' (using password: YES)
[root@localhost init.d]# sudo /usr/bin/mysqld_safe -skip-grant &
[2] 15644
[root@localhost init.d]# 210708 15:52:09 mysqld_safe Logging to '/var/lib/mysql/localhost.localdomain.err'.
210708 15:52:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

[root@localhost init.d]#
[root@localhost init.d]# mysql -u root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost init.d]# mysqld --skip-grant
210708 15:53:12 [Note] mysqld (mysqld 5.5.68-MariaDB) starting as process 15750 ...
mysqld: Please consult the Knowledge Base to find out how to run mysqld as root!
210708 15:53:12 [ERROR] Aborting

210708 15:53:12 [Note] mysqld: Shutdown complete

[root@localhost init.d]# mysqld --skip-grant
210708 15:53:18 [Note] mysqld (mysqld 5.5.68-MariaDB) starting as process 15752 ...
mysqld: Please consult the Knowledge Base to find out how to run mysqld as root!
210708 15:53:18 [ERROR] Aborting

210708 15:53:18 [Note] mysqld: Shutdown complete

[root@localhost init.d]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost init.d]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[2]-  Done                    sudo /usr/bin/mysqld_safe -skip-grant
[root@localhost init.d]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 31
Server version: 5.5.68-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.