내가 사용하고있는 서버는 centOS에 의해 실행되는 ssh 연결이며 LAMP를 플랫폼으로 사용합니다.CentOS와 mariadb를 SSH 서버에 연결하는 Codeigniter가 데이터베이스 관리로 설정하는 데 가능한 설정은 무엇입니까?
CentOS이기 때문에 mariadb 만 사용할 수 있습니다. 나는 sudo yum install mysql-server
명령을 통해 mysql을 설치할 수 없다.
내 로컬에 codeigniter를 사용하여 프로젝트를 만들었습니다.
데이터베이스에 연결하는 데 문제가 있습니다.
이A PHP Error was encountered
Severity: Warning
Message: mysqli::real_connect(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Filename: mysqli/mysqli_driver.php
내 CodeIgniter의에서 DB 설정은 다음과 같습니다 : 같은 오류가 제공
$active_group = 'default';
$query_builder = TRUE;
$db['default'] = array(
'dsn' => '',
'hostname' => '*server-ip-address*',
'port' => '*server-port-number*',
'username' => 'root',
'password' => '[email protected]',
'database' => 'listingapp_db',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
난 그냥 어쩌면 내 데이터베이스 설정이 잘못 생각했다.
dbdriver
설정에 문제가 있습니까? mysqli
을 mariadb
으로 변경하려고했지만 아직 진행되지 않았습니다.
서버의 centOS 인 mariadb와 함께 사용할 수있는 설정은 무엇입니까?
나는 방화벽을 확인하기 위해 sudo는 iptables에 -vnL을 시도하고이 결과 : 지금 내 문제를 해결 한Chain INPUT (policy DROP 10924 packets, 630K bytes)
pkts bytes target prot opt in out source destination
40905 5353K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
1860K 2702M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x00
4 172 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:!0x17/0x02 state NEW
0 0 DROP tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp flags:0x3F/0x3F
158 9480 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
445 28059 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0
57 2800 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:2202
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 1133K packets, 103M bytes)
pkts bytes target prot opt in out source destination
codeigniter에서 mysqli로 mariadb에 연결할 수 있습니다. 문제는 없습니다. 방화벽이 centos가 포트를 차단하고있는 것일 수 있습니다. – ourmandave
@ourmandave 아, 알겠습니다. 하지만 어떻게 포트를 차단 해제 할 수 있습니까? 예제 명령은 무엇입니까? –
실행중인 CentOS의 버전과 firewalld 또는 iptables를 사용 중인지 여부에 따라 다릅니다. 당신은 아마 그 하나 google해야합니다. – ourmandave