programing

MariaDB가 Ubuntu 15.04에서 비밀번호를 확인하지 않습니다.

javaba 2022. 9. 23. 23:12
반응형

MariaDB가 Ubuntu 15.04에서 비밀번호를 확인하지 않습니다.

Ubuntu Server 15.04와 MariaDB 10.0.17을 서버에 설치했습니다.

MariaDB 설치 시 비밀번호 설정 페이지가 표시되지 않아 설치가 완료되었습니다.

그래서 SET PASSWORD와 UPDATE 테이블을 사용하여 루트 비밀번호를 변경하려고 합니다.

하지만, 일어나지 않았다.

MySQL에 접속할 때는 패스워드 없이 패스워드를 사용할 수 있습니다.
다음과 같이 합니다.

root@kuroneko-Server:~# mysql -uroot -p
Enter password: [Type 'itsnotpassword']
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 34
Server version: 10.0.17-MariaDB-0ubuntu1 (Ubuntu)

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

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

MariaDB [(none)]>



플래시 권한을 이미 처리 중이고 service mysql을 재시작합니다.
ubuntu 재설치, mariadb 재설치...기타.

service mysql 상태:

root@kuroneko-Server:~# service mysql status
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: active (running) since 금 2015-05-22 11:17:41 EDT; 34min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 8127 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
  Process: 8158 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/mysql.service
           ├─8183 /bin/bash /usr/bin/mysqld_safe
           ├─8184 logger -p daemon.err -t /etc/init.d/mysql -i
           └─8338 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306

 5월 22 11:17:40 kuroneko-Server systemd[1]: Starting LSB: Start and stop the mysql database server daemon...
 5월 22 11:17:40 kuroneko-Server mysql[8158]: * Starting MariaDB database server mysqld
 5월 22 11:17:41 kuroneko-Server mysql[8158]: ...done.
 5월 22 11:17:41 kuroneko-Server systemd[1]: Started LSB: Start and stop the mysql database server daemon.


MariaDB 설정

[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1

#
# * Fine Tuning
#
key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10

#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M

#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# Here you can see queries with especially long duration
#log_slow_queries       = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                        = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size   = 100M
#binlog_do_db           = include_database_name
#binlog_ignore_db       = include_database_name

#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!

#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
character-set-server  = utf8
collation-server      = utf8_general_ci
character_set_server   = utf8
collation_server       = utf8_general_ci

#
# * Unix socket authentication plugin
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
plugin-load-add         = auth_socket.so


아는 사람 있어요?

이 문제에 대한 정보를 찾을 수 없습니다.

참조: http://ubuntuforums.org/showthread.php?t=2275033

다음 sql을 실행합니다.

USE mysql; 

UPDATE user 
SET password=PASSWORD('NEW_PASSWORD'), 
    plugin='' 
WHERE user='root';

FLUSH PRIVILEGES;

PS: 안전한 고려를 위해plugin[ root ]사용자 이외의 로그인을 방지하기 위해 [ root users ]필드가 설정되었습니다.따라서 플러그인을 취소하면 됩니다.

정답은 구성 파일에 있습니다.

#
# * Unix socket authentication plugin
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/
plugin-load-add         = auth_socket.so

auth_socket.so를 사용하면 루트일 때 비밀번호 프롬프트 없이 로그인할 수 있습니다.따라서 "mysql"을 입력하는 것만으로 이상적으로 로그인할 수 있습니다.

MariaDB 10.0.17은 루트 사용자가 아닌 루트에 액세스할 수 없습니다.
(웹 액세스 포함)

ubuntu root 사용자라면 누구나 MariaDB root에 액세스할 수 있습니다.
(인정 없음)

따라서 웹에서 새로운 root2 사용자를 managed mysql로 만듭니다.

UNIX 소켓 인증 플러그인은 10.0.22-6부터 내장되어 있습니다.

root 데이터베이스 사용자가 패스워드 없이 인증할 수 있도록 하기 위해 필요하지만 unix root 사용자로 실행하는 경우에만 필요합니다.

필요한 경우 다른 사용자도 사용할 수 있습니다.https://mariadb.com/kb/en/unix_socket-authentication-plugin/ 를 참조해 주세요.

언급URL : https://stackoverflow.com/questions/30401185/mariadb-is-not-checking-password-on-ubuntu-15-04

반응형