MySQL에 비밀번호 사용을 요청하려면 어떻게 해야 합니까?

MySQL에 비밀번호 사용을 요청하려면 어떻게 해야 합니까?

MySQL을 시작하고 업그레이드를 확인할 때 MySQL에게 루트 사용자의 비밀번호를 사용하도록 요청하려면 어떻게 해야 합니까?

localhost systemd[1]: Started MariaDB 10.3.25 database server.
localhost /etc/mysql/debian-start[1126]: Upgrading MySQL tables if necessary.
localhost systemd[1]: Started OpenLiteSpeed HTTP Server.
localhost /etc/mysql/debian-start[1131]: Looking for 'mysql' as: /usr/bin/mysql
localhost /etc/mysql/debian-start[1131]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
localhost /etc/mysql/debian-start[1131]: Version check failed. Got the following error when calling the 'mysql' command line client
localhost /etc/mysql/debian-start[1131]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
localhost /etc/mysql/debian-start[1131]: FATAL ERROR: Upgrade failed
localhost /etc/mysql/debian-start[1157]: Checking for insecure root accounts.

루트 사용자의 비밀번호가 있지만 MySQL이 시작될 때: (using password: 아니요)

나는 MariaDB 10.3.25를 실행합니다.OpenLite속도, 우분투 20.04.

답변1

/etc/mysql/debian.cnf이 파일에는 비밀번호 필드가 null이므로 비밀번호를 추가했습니다 .

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = root
password =
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = root
password =
socket   = /var/run/mysqld/mysqld.sock

이제 MySQL 시작 및 서버 재부팅 시 필요한 경우 MySQL을 성공적으로 업그레이드했습니다.

/etc/mysql/debian-start[961]: Upgrading MySQL tables if necessary.
/etc/mysql/debian-start[975]: Looking for 'mysql' as: /usr/bin/mysql
/etc/mysql/debian-start[975]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
/etc/mysql/debian-start[975]: This installation of MySQL is already upgraded to 10.3.25-MariaDB, use --force if you still need to run mysql_upgrade

다른 일은 다 잘 되는 것 같습니다.

이 방법을 사용하지 말아야 한다면 알려주십시오. /etc/mysql/debian.cnf첫 번째 문자열은 # 데비안 스크립트에 대해 자동으로 생성되었습니다.만지지 마세요!

관련 정보