웹사이트 검색

PhpMyAdmin에 대한 루트 로그인 액세스를 비활성화하는 방법


정기적으로 phpmyadmin을 사용하여 네트워크(또는 인터넷을 통해!)를 통해 데이터베이스를 관리할 계획이라면 루트를 사용하고 싶지 않을 것입니다. > 계정. 이는 phpmyadmin뿐만 아니라 다른 웹 기반 인터페이스에도 유효합니다.

/etc/phpmyadmin/config.inc.php에서 다음 줄을 찾아 AllowRoot 지시문이 FALSE로 설정되어 있는지 확인하세요.

$cfg['Servers'][$i]['AllowRoot'] = FALSE;

Ubuntu/Debian에서는 다음 두 줄을 다음과 같이 추가해야 합니다.

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowRoot'] = false;

변경사항을 저장하고 Apache를 다시 시작하세요.

------------- On CentOS/RHEL Systems -------------
systemctl restart httpd.service

------------- On Debian/Ubuntu Systems -------------
systemctl restart apache2.service

그런 다음 위 팁에 설명된 단계에 따라 phpmyadmin 로그인 페이지(https:///phpmyadmin)로 이동하여 루트로 로그인해 보세요.

그런 다음 명령 프롬프트를 통해 MySQL/MariaDB 데이터베이스에 연결하고 루트 자격 증명을 사용하여 각각 하나의 데이터베이스에 액세스하는 데 필요한 만큼의 계정을 만듭니다. 이 경우 비밀번호가 jdoespasswordjdoe라는 계정을 만듭니다.

mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 24
Server version: 10.1.14-MariaDB MariaDB Server

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

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

MariaDB [(none)]> CREATE USER 'jdoe'@'localhost' IDENTIFIED BY 'jdoespassword';
Query OK, 0 rows affected (0.04 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON gestion.* to 'jdoe'@'localhost';
Query OK, 0 rows affected (0.00 sec)

그럼 위의 자격 증명을 사용하여 로그인해 보겠습니다. 보시다시피 이 계정은 하나의 데이터베이스에만 액세스할 수 있습니다.

축하해요! phpmyadmin 설치에 대한 루트 액세스를 비활성화했으며 이제 이를 사용하여 데이터베이스를 관리할 수 있습니다.

사용자 이름비밀번호 전송을 방지하려면 .htaccess 비밀번호 보호 및 설정 HTTPS(SSL 인증서)를 사용하여 phpmyadmin 설치에 추가 보안 계층을 추가하는 것이 좋습니다. 네트워크를 통해 일반 텍스트 형식으로 표시됩니다.