MariaDB에서 프롬프트 기록을 제거할 수 있습니까?
주요 문제는 (다른 많은 문장 중에서도) MariaDB에 보안에 민감한 문장을 썼다는 것입니다. 따라서 Linux의 history -c 명령과 같이) 프롬프트 기록을 제거하려고 합니다.
jordiba90@lts:~$ sudo mariadb -u root -p
[sudo] contraseña para jordiba90:
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 36
Server version: 10.3.25-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> USE mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> UPDATE user SET password=PASSWORD("PASSWORD") WHERE user="root";
Query OK, 0 rows affected (0.001 sec)
Rows matched: 1 Changed: 0 Warnings: 0
MariaDB [mysql]> FLUSH privileges;
Query OK, 0 rows affected (0.001 sec)
키보드의 위/아래 버튼을 클릭하면 모든 프롬프트 내역이 표시됩니다.
MariaDB에서 프롬프트 기록을 제거하려고 해도 작동하지 않습니다.
MariaDB [(none)]> clear
MariaDB [(none)]> \c
MariaDB [(none)]> quit
Bye
그래서 인터넷에서 이 스크립트를 확인했습니다(그것도 작동하지 않습니다).
jordiba90@lts:~$ rm ~/.mysql_history
jordiba90@lts:~$ export MYSQL_HISTFILE=/dev/null
jordiba90@lts:~$ set | grep MYSQ
MYSQL_HISTFILE=/dev/null
_=MYSQL_HISTFILE=/dev/null
참조 > https://www.thegeekstuff.com/2010/01/disable-mysql-history-clear-mysql_history-and-mysql_histfile/
그 후 인터넷에서 다른 스크립트도 확인했습니다(그것도 작동하지 않습니다, 다시 한번).
jordiba90@lts:~$ ~/.mysql_history
bash: /home/jordiba90/.mysql_history: No existe el archivo o el directorio
jordiba90@lts:~$ rm $HOME/.mysql_history
rm: no se puede borrar '/home/jordiba90/.mysql_history': No existe el archivo o el directorio
jordiba90@lts:~$ ln -s /dev/null $HOME/.mysql_history
참조 > https://www.cyberciti.biz/faq/howto-clear-mysql-command-history/
OS에 "mysql"과 관련된 파일이 너무 많지만 mysql 기록과 관련된 파일이 없어서 mysql 구성과 관련된 모든 파일을 일일이 확인했지만 제거해야 할 파일을 찾지 못했습니다.
jordiba90@lts:~$ locate mysql | wc
421 421 25918
jordiba90@lts:~$ locate mysql | grep history
jordiba90@lts:~$ locate mysql | grep conf
/etc/mysql/conf.d
/etc/mysql/conf.d/mysql.cnf
/etc/mysql/conf.d/mysqldump.cnf
/etc/mysql/mariadb.conf.d
/etc/mysql/mariadb.conf.d/50-client.cnf
/etc/mysql/mariadb.conf.d/50-mysql-clients.cnf
/etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf
/etc/mysql/mariadb.conf.d/50-server.cnf
/usr/share/mysql-common/configure-symlinks
/usr/share/mysql/systemd/use_galera_new_cluster.conf
/var/lib/dpkg/info/mysql-common.conffiles
한편 mariadb 파일에서도 마찬가지입니다.
jordiba90@lts:~$ locate mariadb | wc
101 101 5042
jordiba90@lts:~$ locate mariadb | grep history
jordiba90@lts:~$ locate mariadb | grep conf
/etc/insserv.conf.d/mariadb
/etc/mysql/mariadb.conf.d
/etc/mysql/mariadb.conf.d/50-client.cnf
/etc/mysql/mariadb.conf.d/50-mysql-clients.cnf
/etc/mysql/mariadb.conf.d/50-mysqld_safe.cnf
/etc/mysql/mariadb.conf.d/50-server.cnf
/usr/lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf
/var/lib/dpkg/info/mariadb-client-10.3.conffiles
/var/lib/dpkg/info/mariadb-common.conffiles
/var/lib/dpkg/info/mariadb-server-10.3.conffiles
/var/lib/dpkg/info/mariadb-server-10.3.config
힌트 좀 주시겠어요?당신은 제가 그것을 먹어봤는지 확인할 수 있습니다.잘 부탁드립니다.
PS_1: 스택*에 이 주제에 대한 다른 항목이 있거나(확인했지만 보지 못했습니다), 제 항목이 스택*에 대한 규칙을 위반하는 경우(규칙을 확인했지만 위반하지 않았다고 생각합니다), PM을 보내주시면 이 항목을 삭제하겠습니다.질문을 해서 평판 점수를 잃지 않고 배우려고 노력하고 있습니다.
PS_2: mysql을 다시 시작했고 현재 상태는 활성(실행 중)입니다.
jordiba90@lts:~$ sudo /etc/init.d/mysql restart
Restarting mysql (via systemctl): mysql.service.
jordiba90@lts:~$ sudo /etc/init.d/mysql status
● mariadb.service - MariaDB 10.3.25 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2020-11-14 13:24:47 CET; 8h ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 826 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 861 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 876 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS)
Process: 1026 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 1028 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
Main PID: 957 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 31 (limit: 9423)
Memory: 93.1M
CGroup: /system.slice/mariadb.service
└─957 /usr/sbin/mysqld
nov 14 13:24:46 lts systemd[1]: Starting MariaDB 10.3.25 database server...
nov 14 13:24:47 lts mysqld[957]: 2020-11-14 13:24:47 0 [Note] /usr/sbin/mysqld (mysqld 10.3.25-MariaDB-0ubuntu0.20.04.1) starting as…ess 957 ...
nov 14 13:24:47 lts mysqld[957]: 2020-11-14 13:24:47 0 [Warning] Could not increase number of max_open_files to more than 16384 (request: 32186)
nov 14 13:24:47 lts systemd[1]: Started MariaDB 10.3.25 database server.
nov 14 13:24:47 lts /etc/mysql/debian-start[1030]: Upgrading MySQL tables if necessary.
nov 14 13:24:47 lts /etc/mysql/debian-start[1033]: Looking for 'mysql' as: /usr/bin/mysql
nov 14 13:24:47 lts /etc/mysql/debian-start[1033]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
nov 14 13:24:47 lts /etc/mysql/debian-start[1033]: This installation of MySQL is already upgraded to 10.3.25-MariaDB, use --force if y…l_upgrade
Hint: Some lines were ellipsized, use -l to show in full.
참조 > https://superuser.com/questions/282115/how-to-restart-mysql
PS_3: 명령어를 사용해 보았습니다.stat ~/.mysql_history; rm ~/.mysql_history; stat ~/.mysql_history
그리고 제가 가진 출력은 파일이나 디렉토리입니다./home/jordiba90/.mysql_history
존재하지 않음
PS_4: 명령어를 사용해 보았습니다.strace mysql
메시지 본문이 30,000자로 제한되어 있기 때문에 출력을 여기서 공유할 수 없습니다(그리고 그렇게 하면 프록시인 44.321을 입력했어야 합니다).
PS_5: 특정 출력 확인 완료openat(AT_FDCWD...
mysql_history와 관련된 내용이 없습니다.특정한 문장이 아닌 것 같습니다.
PS_6: 'sudo'를 사용하여 'trace mysql' 명령을 사용해 본 결과 mysql history와 관련된 다음과 같은 출력이 있습니다.
openat(AT_FDCWD, "/root/.mysql_history", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0600, st_size=4585, ...}) = 0
read(4, "misql -u root -p\nDatascience2005"..., 4585) = 4585
close(4) = 0
write(1, "\33(B\33[m\33(B\33[0;1mType 'help;' or '"..., 94Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
) = 94
write(1, "\n", 1
)
된 마지막 PS_7: 이름된지 mysql history와를 했습니다./root/.mysql_history
저는 .
이 경우 기록 파일 편집(예: vim을 사용한 편집 및 문제가 있는 행 삭제)이 작동했습니다.
vim ~/.mysql_history
(mysql Ver 15.1 분포 10.4.14-MariaDB)
설정 방법에 따라 루트에 위치할 수 있습니다.Ubuntu 22.04에서 MariaDB를 새로 보안으로 설치할 때도 동일했습니다.내 위치는 /root/.mysql_history입니다.
excellent locate 명령을 사용하고(updateb 명령을 사용하여 추가된 새 파일의 데이터베이스를 업데이트하는 것을 기억하십시오) mysql_history를 검색하는 것이 일반적인 방법임을 알게 되었습니다.
locate -i mysql_history
MariaDB 또는 MySQL 셸 자체가 아닌 파일 시스템에서 파일을 검색할 때 bash(또는 사용 중인 모든) 명령 프롬프트에서 이 검색을 수행합니다.
이 검색에서는 mysql_history가 소문자이기 때문에 -i 옵션이 실제로 필요하지는 않지만 알 수 없습니다!
역사를 검색하는 것도 효과가 있을 것이지만 몇 번 더 검색할 수 있습니다.
파일을 찾았으면 선택한 편집기를 사용하여 해당 파일에서 찾을 수 있는 중요한 명령줄을 제거할 수 있습니다.
언급URL : https://stackoverflow.com/questions/64838432/is-it-possible-to-remove-the-prompt-history-on-mariadb
'programing' 카테고리의 다른 글
MYSQL 쿼리에서 열의 평균 계산 (0) | 2023.08.18 |
---|---|
Angular 4에서 매트-페이지네이터를 어떻게 번역합니까? (0) | 2023.08.18 |
ASP.NET에서 응답에 파일을 쓴 후 Post Back이 작동하지 않음 (0) | 2023.08.18 |
Twitter 부트스트랩의 트리 (0) | 2023.08.18 |
이 평균 가격 루프를 더 빠르게 수행할 수 있는 방법이 있습니까? (0) | 2023.08.18 |