반응형
비밀번호 없이 sudo를 사용하여 mariaDB에 연결
시스템 사용자인 MariaDB를 새로 설치한 후root
암호 없이 루트로 연결할 수 있습니다.sudo mysql -u root
백업을 다시 가져온 후에는 더 이상 이 작업을 수행할 수 없습니다.
user@server:~$ sudo mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
테이블mysql.user
포함:
MariaDB [mysql]> select host, user, password, plugin from mysql.user;
+-----------+------------+-------------------------------------------+-----------------------+
| host | user | password | plugin |
+-----------+------------+-------------------------------------------+-----------------------+
| localhost | root | | mysql_native_password |
| localhost | phpmyadmin | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | mysql_native_password |
| % | user1 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | mysql_native_password |
| localhost | seafile | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | mysql_native_password |
| localhost | gogs | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | mysql_native_password |
| localhost | user2 | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
| localhost | freshrss | *xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
+-----------+------------+-------------------------------------------+-----------------------+
7 rows in set (0,001 sec)
어떻게 하면 이 행동을 되돌릴 수 있을까요?
mariadb 10.5와 debian 11을 사용하고 있습니다.
감사해요.
첫 번째, MariaDB-10.4 이후 버전mysql.user
사용자와 관련된 모든 내용을 포함하지 않는 보기입니다. mysql.global_priv
더 완전한 버전입니다.
사용자의 전체 보기를 보려면 다음을 사용합니다.show create user root@localhost
.
MariaDB [mysql]> alter user root@localhost IDENTIFIED VIA unix_socket;
Query OK, 0 rows affected (0.000 sec)
MariaDB [mysql]> show create user root@localhost;
+-----------------------------------------------------------+
| CREATE USER for root@localhost |
+-----------------------------------------------------------+
| CREATE USER `root`@`localhost` IDENTIFIED VIA unix_socket |
+-----------------------------------------------------------+
1 row in set (0.000 sec)
언급URL : https://stackoverflow.com/questions/75978151/connect-to-mariadb-with-sudo-without-password
반응형
'sourcecode' 카테고리의 다른 글
Firestore - 특정 필드 변경을 들으시겠습니까? (0) | 2023.06.17 |
---|---|
c#에서 이중 값을 DateTime으로 변환하는 방법은 무엇입니까? (0) | 2023.06.17 |
MS Excel은 결과 값 대신 셀에 수식을 표시합니다. (0) | 2023.06.17 |
C와 C++의 표준 헤더 파일 목록 (0) | 2023.06.17 |
Angular 앱에서 rxjs 관련 메모리 누수를 감지하는 방법 (0) | 2023.06.17 |